summaryrefslogtreecommitdiffstats
path: root/src/qdoc/clangcodeparser.h
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2020-04-14 15:30:36 +0200
committerTopi Reiniƶ <topi.reinio@qt.io>2020-04-21 06:04:31 +0000
commitd53af222939321fb816d44f86588c3eb8c255e10 (patch)
treec56b5853d743a516a1cb540ba5e8f3218c1eec56 /src/qdoc/clangcodeparser.h
parent8f379adf059977c04c2105b6ca73b04b1a923d8a (diff)
qdoc: Fix handling of default values for function parameters
When using an \fn command to document a function that has default values for parameter(s), The Clang parser retrieves a relevant section of the source file that contains the expression for the default value. In case of \fn, the source is a temporary translation unit that was constructed on the fly - but it may not exist anymore, and the default value is lost. Fix this by storing the contents of the temporary TU for later access. Fixes: QTBUG-83472 Change-Id: I20ad9e3322636450db1def65933837c1c767f2c4 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/clangcodeparser.h')
-rw-r--r--src/qdoc/clangcodeparser.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qdoc/clangcodeparser.h b/src/qdoc/clangcodeparser.h
index 9af292e67..1575d31fb 100644
--- a/src/qdoc/clangcodeparser.h
+++ b/src/qdoc/clangcodeparser.h
@@ -62,6 +62,7 @@ public:
void parseSourceFile(const Location &location, const QString &filePath) override;
void precompileHeaders() override;
Node *parseFnArg(const Location &location, const QString &fnArg) override;
+ static const QByteArray &fn() { return fn_; }
private:
void getDefaultArgs();
@@ -79,6 +80,7 @@ private:
std::vector<const char *> args_;
QVector<QByteArray> moreArgs_;
QStringList namespaceScope_;
+ static QByteArray fn_;
};
QT_END_NAMESPACE