diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2022-06-20 08:56:31 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2022-06-23 10:40:48 +0200 |
commit | 18a38fe6520da67a51c39c56b2a6156727454b75 (patch) | |
tree | d1498b5f21dd13691162b00201fd1288d00b56bf /src/linguist/lupdate/cpp.cpp | |
parent | 1364c1363406eda9b462f4e48ed09248ae0cdaf8 (diff) |
lupdate: Allow multiple specifiers after method signature
...in the old C++ parser.
Out of line method definitions with multiple specifiers resulted in an
lupdate warning. Example:
class MyClass {
Q_OBJECT
QString text() const noexcept;
}
QString MyClass::text() const noexcept { return tr("foo"); }
The reason was that we discarded the prospective context ("MyClass")
after encountering two consecutive identifier tokens (const noexcept).
Presumably, this was done to discard the context in the case of return
types such as in:
std::string myFunc() { return tr("foo").toStdString(); }
The code discards the prospective context "std" upon encountering
"myFunc". However, this is such an edge case, given that it's unlikely
that people have a global tr function defined, we can happily allow this
wrongness in favor of fixing the frequent occurrence of multiple
specifiers after a parameter list.
[ChangeLog][lupdate] lupdate does not trip anymore over tr() calls in
methods with multiple specifiers. For example
"QString MyClass::foo() const noexcept" now gets the correct context.
Fixes: QTBUG-99415
Change-Id: I54afb96270fae1651dcf19fb9c479fa4cba3ede8
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit afbc20ed01e187c1af6ae55f6a9a3a512b183f1c)
Diffstat (limited to 'src/linguist/lupdate/cpp.cpp')
-rw-r--r-- | src/linguist/lupdate/cpp.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp index adaed23de..d173da32f 100644 --- a/src/linguist/lupdate/cpp.cpp +++ b/src/linguist/lupdate/cpp.cpp @@ -1959,8 +1959,6 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac } else { notrfunc: prefix.clear(); - if (yyTok == Tok_Ident && !yyParenDepth) - prospectiveContext.clear(); } metaExpected = false; break; |