summaryrefslogtreecommitdiff
path: root/src/qdoc/clangcodeparser.cpp
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2018-08-31 09:08:29 +0200
committerPaul Wicking <paul.wicking@qt.io>2018-09-03 11:32:14 +0000
commit86c81299da938eb5443fccfa8e72b73ea6d8d8bf (patch)
tree37ad2252e4c899039b5715ade79cb0bc8b9ee490 /src/qdoc/clangcodeparser.cpp
parente1dee72874fa5845220556985fc11a549eb65fc9 (diff)
downloadqttools-86c81299da938eb5443fccfa8e72b73ea6d8d8bf.tar.gz
QDoc: Clean up code, old style casts and more 0 nullptr constants
Change-Id: I96ff2ba00f419796a8649d5392f7c164579b0d16 Reviewed-by: Martin Smith <martin.smith@qt.io>
Diffstat (limited to 'src/qdoc/clangcodeparser.cpp')
-rw-r--r--src/qdoc/clangcodeparser.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp
index 330697082..bc76a2068 100644
--- a/src/qdoc/clangcodeparser.cpp
+++ b/src/qdoc/clangcodeparser.cpp
@@ -60,8 +60,8 @@
QT_BEGIN_NAMESPACE
-static CXTranslationUnit_Flags flags_ = (CXTranslationUnit_Flags)0;
-static CXIndex index_ = 0;
+static CXTranslationUnit_Flags flags_ = static_cast<CXTranslationUnit_Flags>(0);
+static CXIndex index_ = nullptr;
#ifndef QT_NO_DEBUG_STREAM
template <class T>
@@ -531,7 +531,7 @@ CXChildVisitResult ClangVisitor::visitFnSignature(CXCursor cursor, CXSourceLocat
case CXCursor_ConversionFunction: {
ignoreSignature = false;
if (ignoredSymbol(functionName(cursor))) {
- *fnNode = 0;
+ *fnNode = nullptr;
ignoreSignature = true;
} else {
*fnNode = findFunctionNodeForCursor(qdb_, cursor);
@@ -621,7 +621,7 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
}
case CXCursor_Namespace: {
QString namespaceName = fromCXString(clang_getCursorDisplayName(cursor));
- NamespaceNode* ns = 0;
+ NamespaceNode* ns = nullptr;
if (parent_)
ns = static_cast<NamespaceNode*>(parent_->findChildNode(namespaceName, Node::Namespace));
if (!ns) {
@@ -742,7 +742,7 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
if (findNodeForCursor(qdb_, cursor)) // Was already parsed, propably in another tu
return CXChildVisit_Continue;
QString enumTypeName = fromCXString(clang_getCursorSpelling(cursor));
- EnumNode* en = 0;
+ EnumNode* en = nullptr;
if (enumTypeName.isEmpty()) {
enumTypeName = "anonymous";
if (parent_ && (parent_->isClass() || parent_->isNamespace())) {
@@ -1297,7 +1297,7 @@ void ClangCodeParser::precompileHeaders()
for (const auto &p : qAsConst(moreArgs_))
args_.push_back(p.constData());
- flags_ = (CXTranslationUnit_Flags) (CXTranslationUnit_Incomplete | CXTranslationUnit_SkipFunctionBodies | CXTranslationUnit_KeepGoing);
+ flags_ = static_cast<CXTranslationUnit_Flags>(CXTranslationUnit_Incomplete | CXTranslationUnit_SkipFunctionBodies | CXTranslationUnit_KeepGoing);
// Change 2nd parameter to 1 to make clang report errors.
index_ = clang_createIndex(1, Generator::debugging() ? 1 : 0);
buildPCH();
@@ -1314,7 +1314,7 @@ void ClangCodeParser::precompileHeaders()
void ClangCodeParser::parseSourceFile(const Location& /*location*/, const QString& filePath)
{
currentFile_ = filePath;
- flags_ = (CXTranslationUnit_Flags) (CXTranslationUnit_Incomplete | CXTranslationUnit_SkipFunctionBodies | CXTranslationUnit_KeepGoing);
+ flags_ = static_cast<CXTranslationUnit_Flags>(CXTranslationUnit_Incomplete | CXTranslationUnit_SkipFunctionBodies | CXTranslationUnit_KeepGoing);
index_ = clang_createIndex(1, 0);
getDefaultArgs();
@@ -1410,7 +1410,7 @@ void ClangCodeParser::parseSourceFile(const Location& /*location*/, const QStrin
*/
Node* ClangCodeParser::parseFnArg(const Location& location, const QString& fnArg)
{
- Node* fnNode = 0;
+ Node* fnNode = nullptr;
/*
If the \fn command begins with a tag, then don't try to
parse the \fn command with clang. Use the tag to search
@@ -1461,7 +1461,7 @@ Node* ClangCodeParser::parseFnArg(const Location& location, const QString& fnArg
}
return fnNode;
}
- CXTranslationUnit_Flags flags = (CXTranslationUnit_Flags) (CXTranslationUnit_Incomplete |
+ CXTranslationUnit_Flags flags = static_cast<CXTranslationUnit_Flags>(CXTranslationUnit_Incomplete |
CXTranslationUnit_SkipFunctionBodies |
CXTranslationUnit_KeepGoing);
// Change 2nd parameter to 1 to make clang report errors.
@@ -1508,7 +1508,7 @@ Node* ClangCodeParser::parseFnArg(const Location& location, const QString& fnArg
ClangVisitor visitor(qdb_, allHeaders_);
bool ignoreSignature = false;
visitor.visitFnArg(cur, &fnNode, ignoreSignature);
- if (fnNode == 0) {
+ if (fnNode == nullptr) {
unsigned diagnosticCount = clang_getNumDiagnostics(tu);
if (diagnosticCount > 0 && (!Generator::preparing() || Generator::singleExec())) {
bool report = true;