From 99120ca3cf2a22f89fd7ec46ff483882fc3a2bbe Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 26 Feb 2015 10:34:47 +0100 Subject: qdoc: Correct parsing of the using clause MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qdoc could only parse the using clause where the 'using' keyword was followed by 'namespace'. Now it can parse using clauses with or without 'namespace'. Change-Id: Ic4aad025c00b3bda2bc1cbd52d0ba8dbbad653e5 Task-number: QTBUG-44553 Reviewed-by: Alex Blasche Reviewed-by: Topi Reiniƶ --- src/tools/qdoc/cppcodeparser.cpp | 85 +++++++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 22 deletions(-) (limited to 'src/tools/qdoc/cppcodeparser.cpp') diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index 405be6f500b..6cb86a7515c 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -1692,35 +1692,76 @@ bool CppCodeParser::matchNamespaceDecl(InnerNode *parent) return matched && match(Tok_RightBrace); } -bool CppCodeParser::matchUsingDecl() +/*! + Match a C++ \c using clause. Return \c true if the match + is successful. Otherwise false. + + If the \c using clause is for a namespace, an open namespace + insertOpenNamespace(name); + if (usingNamespace) { + // 'using namespace Foo;'. + qdb_->insertOpenNamespace(name); + } + else if (parent && parent->isClass()) { + ClassNode* cn = static_cast(parent); + cn->addUnresolvedUsingClause(name); + } return true; } @@ -1961,7 +2002,7 @@ bool CppCodeParser::matchDeclList(InnerNode *parent) matchNamespaceDecl(parent); break; case Tok_using: - matchUsingDecl(); + matchUsingDecl(parent); break; case Tok_template: { @@ -2221,7 +2262,7 @@ bool CppCodeParser::matchDocsAndStuff() } } else if (tok == Tok_using) { - matchUsingDecl(); + matchUsingDecl(0); } else { QStringList parentPath; -- cgit v1.2.3