diff options
author | BogDan Vatra <bogdan@kdab.com> | 2016-09-19 12:34:56 +0300 |
---|---|---|
committer | BogDan Vatra <bogdan@kdab.com> | 2016-09-28 06:56:28 +0000 |
commit | c2d5af480c14d77f2c58ca052e83ceddbca3b4e0 (patch) | |
tree | 09987b28a8af41e73d6e0f376e0fa32cf6f8482e | |
parent | e51a3367ea7d73b5e3832d0d465afc0d567d926b (diff) |
Handle Q_NAMESPACE
Q_NAMESPACE will be introduced in Qt 5.8 which is used to add metafinfo to a namespace
Change-Id: I16eacc488e9d9705305ced0847d3ad7bc8557292
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/plugins/scanner/cpp/Token.cpp | 1 | ||||
-rw-r--r-- | src/plugins/scanner/cpp/Token.h | 3 | ||||
-rw-r--r-- | src/plugins/scanner/cpp/cppscanner.cpp | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/scanner/cpp/Token.cpp b/src/plugins/scanner/cpp/Token.cpp index 1eef90afa..7d39d5b89 100644 --- a/src/plugins/scanner/cpp/Token.cpp +++ b/src/plugins/scanner/cpp/Token.cpp @@ -100,6 +100,7 @@ static const char *token_names[] = { ("Q_FOREACH"), ("Q_D"), ("Q_Q"), ("Q_INVOKABLE"), ("Q_PROPERTY"), ("Q_INTERFACES"), ("Q_ENUMS"), ("Q_FLAGS"), ("Q_PRIVATE_SLOT"), ("Q_DECLARE_INTERFACE"), ("Q_OBJECT"), ("Q_GADGET"), + ("Q_NAMESPACE"), }; diff --git a/src/plugins/scanner/cpp/Token.h b/src/plugins/scanner/cpp/Token.h index 3dafa9356..874597ce5 100644 --- a/src/plugins/scanner/cpp/Token.h +++ b/src/plugins/scanner/cpp/Token.h @@ -249,7 +249,8 @@ enum Kind { T_Q_DECLARE_INTERFACE, T_Q_OBJECT, T_Q_GADGET, - T_LAST_KEYWORD = T_Q_GADGET, + T_Q_NAMESPACE, + T_LAST_KEYWORD = T_Q_NAMESPACE, // aliases T_OR = T_PIPE_PIPE, diff --git a/src/plugins/scanner/cpp/cppscanner.cpp b/src/plugins/scanner/cpp/cppscanner.cpp index ffe76f662..2ead72aa8 100644 --- a/src/plugins/scanner/cpp/cppscanner.cpp +++ b/src/plugins/scanner/cpp/cppscanner.cpp @@ -127,6 +127,7 @@ static void scanCppFile(void *opaq, Lexer &yylex, bool scanForFileTags, bool sca const QLatin1Literal defineLiteral("define"); const QLatin1Literal qobjectLiteral("Q_OBJECT"); const QLatin1Literal qgadgetLiteral("Q_GADGET"); + const QLatin1Literal qnamespaceLiteral("Q_NAMESPACE"); const QLatin1Literal pluginMetaDataLiteral("Q_PLUGIN_METADATA"); Opaq *opaque = static_cast<Opaq *>(opaq); const TokenComparator tc(opaque->fileContent); @@ -164,7 +165,8 @@ static void scanCppFile(void *opaq, Lexer &yylex, bool scanForFileTags, bool sca // Someone was clever and redefined Q_OBJECT or Q_PLUGIN_METADATA. // Example: iplugin.h in Qt Creator. } else { - if (tc.equals(tk, qobjectLiteral) || tc.equals(tk, qgadgetLiteral)) + if (tc.equals(tk, qobjectLiteral) || tc.equals(tk, qgadgetLiteral) || + tc.equals(tk, qnamespaceLiteral)) { opaque->hasQObjectMacro = true; } else if (opaque->fileType == Opaq::FT_HPP |