From f17ec3aac885cd347a3d3c6d74541a9aadc5fc78 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 22 Jan 2019 13:20:47 +0100 Subject: QDoc: filter out internal nodes when processing args CppCodeParser::processTopicArgs() neglected to check whether nodes are internal (or internals are to be included) before including them. Add Doc::isInternal() and CodeParser::showInternal() to let it check this and add the check. Tidied up surrounding code in the process. Change-Id: I9e1ca379a8e58c1519c345bbf98f441915998061 Reviewed-by: Paul Wicking --- src/qdoc/cppcodeparser.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src/qdoc/cppcodeparser.cpp') diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index 83b989033..20341b769 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -1397,17 +1397,19 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL processQmlProperties(doc, nodes, docs, true); } else { ArgList args = doc.metaCommandArgs(topic); - Node *node = 0; + Node *node = nullptr; if (args.size() == 1) { - if (topic == COMMAND_FN) - node = parserForLanguage("Clang")->parseFnArg(doc.location(), args[0].first); - else if (topic == COMMAND_MACRO) + if (topic == COMMAND_FN) { + if (showInternal() || !doc.isInternal()) + node = parserForLanguage("Clang")->parseFnArg(doc.location(), args[0].first); + } else if (topic == COMMAND_MACRO) { node = parseMacroArg(doc.location(), args[0].first); - else if (isQMLMethodTopic(topic) || isJSMethodTopic(topic)) + } else if (isQMLMethodTopic(topic) || isJSMethodTopic(topic)) { node = parseOtherFuncArg(topic, doc.location(), args[0].first); - else + } else { node = processTopicCommand(doc, topic, args[0]); - if (node != 0) { + } + if (node != nullptr) { nodes.append(node); docs.append(doc); } @@ -1415,15 +1417,18 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL QVector sharedCommentNodes; ArgList::ConstIterator arg = args.constBegin(); while (arg != args.constEnd()) { - if (topic == COMMAND_FN) - node = parserForLanguage("Clang")->parseFnArg(doc.location(), arg->first); - else if (topic == COMMAND_MACRO) + node = nullptr; + if (topic == COMMAND_FN) { + if (showInternal() || !doc.isInternal()) + node = parserForLanguage("Clang")->parseFnArg(doc.location(), arg->first); + } else if (topic == COMMAND_MACRO) { node = parseMacroArg(doc.location(), arg->first); - else if (isQMLMethodTopic(topic) || isJSMethodTopic(topic)) + } else if (isQMLMethodTopic(topic) || isJSMethodTopic(topic)) { node = parseOtherFuncArg(topic, doc.location(), arg->first); - else + } else { node = processTopicCommand(doc, topic, *arg); - if (node != 0) { + } + if (node != nullptr) { bool found = false; for (SharedCommentNode *scn : sharedCommentNodes) { if (scn->parent() == node->parent()) { -- cgit v1.2.1