summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/cppcodeparser.h
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2013-02-06 13:41:04 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-08 17:37:51 +0100
commit4866fcf0081e0c416c0dc6f85f11eac66cde57ff (patch)
tree2fda9c22690e2f7ab26a912da8545d4659cd8140 /src/tools/qdoc/cppcodeparser.h
parent934afb5c57fce6d28ce0d7ae8ac1450e8d833b17 (diff)
qdoc: Missing links to qRegisterMetaType()
A serious problem in the design of qdoc is its C++ parser. It is an ad hoc recursive descent parser, which has not kept pace with Qt's use of the more esoteric aspects of C++. Part of the problem is that qdoc does not send files through the preprocessor before processing them. The bottom line is qdoc needs the C++ parser used in Qt Creator. But that is a long-term solution. In the short term, we have to introduce minor hacks like this one to keep qdoc going until the parser can be replaced. The problem in this case is that qdoc doesn't handle the QT_PREPEND_NAMESPACE macro in function declarations. The solution is to let qdoc ignore the macro and just use the macro's parameter, which is what qdoc wants anyway. Task-number: QTBUG-28953 Change-Id: I5b9efcc10fa8fb500a44854ee995c2e50e9e16b5 Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'src/tools/qdoc/cppcodeparser.h')
-rw-r--r--src/tools/qdoc/cppcodeparser.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/tools/qdoc/cppcodeparser.h b/src/tools/qdoc/cppcodeparser.h
index 24b1f4c05a..eae5d1e97d 100644
--- a/src/tools/qdoc/cppcodeparser.h
+++ b/src/tools/qdoc/cppcodeparser.h
@@ -59,6 +59,16 @@ class CppCodeParser : public CodeParser
{
Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeParser)
+ struct ExtraFuncData {
+ InnerNode* root; // Used as the parent.
+ Node::Type type; // The node type: Function, etc.
+ bool isAttached; // If true, the method is attached.
+ bool isMacro; // If true, we are parsing a macro signature.
+ ExtraFuncData() : root(0), type(Node::Function), isAttached(false), isMacro(false) { }
+ ExtraFuncData(InnerNode* r, Node::Type t, bool a)
+ : root(r), type(t), isAttached(a), isMacro(false) { }
+ };
+
public:
CppCodeParser();
~CppCodeParser();
@@ -114,11 +124,10 @@ protected:
bool matchDataType(CodeChunk *type, QString *var = 0);
bool matchParameter(FunctionNode *func);
bool matchFunctionDecl(InnerNode *parent,
- QStringList *parentPathPtr = 0,
- FunctionNode **funcPtr = 0,
- const QString &templateStuff = QString(),
- Node::Type type = Node::Function,
- bool attached = false);
+ QStringList *parentPathPtr,
+ FunctionNode **funcPtr,
+ const QString &templateStuff,
+ ExtraFuncData& extra);
bool matchBaseSpecifier(ClassNode *classe, bool isClass);
bool matchBaseList(ClassNode *classe, bool isClass);
bool matchClassDecl(InnerNode *parent,
@@ -134,9 +143,7 @@ protected:
bool makeFunctionNode(const QString &synopsis,
QStringList *parentPathPtr,
FunctionNode **funcPtr,
- InnerNode *root = 0,
- Node::Type type = Node::Function,
- bool attached = false);
+ ExtraFuncData& params);
FunctionNode* makeFunctionNode(const Doc& doc,
const QString& sig,
InnerNode* parent,