forked from qt-creator/qt-creator
Clang: Fix build with clang 7.0
As an addition update the header with Clang-Tidy checks. Change-Id: Ib4a4d324e8cad95403a3e799e352205b05ed7475 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -50,6 +50,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
{
|
{
|
||||||
"android-",
|
"android-",
|
||||||
{
|
{
|
||||||
|
"tring-find-startswith",
|
||||||
{
|
{
|
||||||
"cloexec-",
|
"cloexec-",
|
||||||
{
|
{
|
||||||
@@ -76,7 +77,8 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"open",
|
"open",
|
||||||
"socket"
|
"socket"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"comparison-in-temp-failure-retry"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -93,16 +95,69 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"bool-pointer-implicit-conversion",
|
"bool-pointer-implicit-conversion",
|
||||||
"copy-constructor-init",
|
"copy-constructor-init",
|
||||||
"dangling-handle",
|
"dangling-handle",
|
||||||
|
"exception-escape",
|
||||||
"fold-init-type",
|
"fold-init-type",
|
||||||
"forward-declaration-namespace",
|
"forward-declaration-namespace",
|
||||||
|
"forwarding-reference-overload",
|
||||||
"inaccurate-erase",
|
"inaccurate-erase",
|
||||||
|
"incorrect-roundings",
|
||||||
"integer-division",
|
"integer-division",
|
||||||
"misplaced-operator-in-strlen-in-alloc",
|
"lambda-function-name",
|
||||||
|
{
|
||||||
|
"macro-",
|
||||||
|
{
|
||||||
|
"parentheses",
|
||||||
|
"repeated-side-effects"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"misplaced-",
|
||||||
|
{
|
||||||
|
"operator-in-strlen-in-alloc",
|
||||||
|
"widening-cast"
|
||||||
|
}
|
||||||
|
},
|
||||||
"move-forwarding-reference",
|
"move-forwarding-reference",
|
||||||
"multiple-statement-macro",
|
"multiple-statement-macro",
|
||||||
"string-constructor",
|
"narrowing-conversions",
|
||||||
"suspicious-memset-usage",
|
"parent-virtual-call",
|
||||||
|
{
|
||||||
|
"sizeof-",
|
||||||
|
{
|
||||||
|
"container",
|
||||||
|
"expression"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"string-",
|
||||||
|
{
|
||||||
|
"constructor",
|
||||||
|
"integer-assignment",
|
||||||
|
"literal-with-embedded-nul"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"suspicious-",
|
||||||
|
{
|
||||||
|
"enum-usage",
|
||||||
|
"memset-usage",
|
||||||
|
"missing-comma",
|
||||||
|
"semicolon",
|
||||||
|
"string-compare"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"swapped-arguments",
|
||||||
|
"terminating-continue",
|
||||||
|
"throw-keyword-missing",
|
||||||
"undefined-memory-manipulation",
|
"undefined-memory-manipulation",
|
||||||
|
"undelegated-constructor",
|
||||||
|
{
|
||||||
|
"unused-",
|
||||||
|
{
|
||||||
|
"raii",
|
||||||
|
"return-value"
|
||||||
|
}
|
||||||
|
},
|
||||||
"use-after-move",
|
"use-after-move",
|
||||||
"virtual-near-miss"
|
"virtual-near-miss"
|
||||||
}
|
}
|
||||||
@@ -126,14 +181,22 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"fio38-c",
|
"fio38-c",
|
||||||
"flp30-c",
|
"flp30-c",
|
||||||
"msc30-c",
|
"msc30-c",
|
||||||
|
"msc32-c",
|
||||||
"msc50-cpp",
|
"msc50-cpp",
|
||||||
|
"msc51-cpp",
|
||||||
"oop11-cpp"
|
"oop11-cpp"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"clang-analyzer-",
|
"clang-analyzer-",
|
||||||
{
|
{
|
||||||
"apiModeling.google.GTest",
|
{
|
||||||
|
"apiModeling.",
|
||||||
|
{
|
||||||
|
"TrustNonnull",
|
||||||
|
"google.GTest"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"core.",
|
"core.",
|
||||||
{
|
{
|
||||||
@@ -168,6 +231,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
{
|
{
|
||||||
"cplusplus.",
|
"cplusplus.",
|
||||||
{
|
{
|
||||||
|
"InnerPointer",
|
||||||
"NewDelete",
|
"NewDelete",
|
||||||
"NewDeleteLeaks",
|
"NewDeleteLeaks",
|
||||||
"SelfAssignment"
|
"SelfAssignment"
|
||||||
@@ -207,7 +271,13 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"performance.Padding",
|
{
|
||||||
|
"performance.",
|
||||||
|
{
|
||||||
|
"GCDAntipattern",
|
||||||
|
"Padding"
|
||||||
|
}
|
||||||
|
},
|
||||||
"portability.UnixAPI"
|
"portability.UnixAPI"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -222,6 +292,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"cocoa.",
|
"cocoa.",
|
||||||
{
|
{
|
||||||
"AtSync",
|
"AtSync",
|
||||||
|
"AutoreleaseWrite",
|
||||||
"ClassRelease",
|
"ClassRelease",
|
||||||
"Dealloc",
|
"Dealloc",
|
||||||
"IncompatibleMethodTypes",
|
"IncompatibleMethodTypes",
|
||||||
@@ -233,6 +304,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"NonNilReturnValue",
|
"NonNilReturnValue",
|
||||||
"ObjCGenerics",
|
"ObjCGenerics",
|
||||||
"RetainCount",
|
"RetainCount",
|
||||||
|
"RunLoopAutoreleaseLeak",
|
||||||
"SelfInit",
|
"SelfInit",
|
||||||
"SuperDealloc",
|
"SuperDealloc",
|
||||||
"UnusedIvars",
|
"UnusedIvars",
|
||||||
@@ -264,6 +336,9 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"insecureAPI.",
|
"insecureAPI.",
|
||||||
{
|
{
|
||||||
"UncheckedReturn",
|
"UncheckedReturn",
|
||||||
|
"bcmp",
|
||||||
|
"bcopy",
|
||||||
|
"bzero",
|
||||||
"getpw",
|
"getpw",
|
||||||
"gets",
|
"gets",
|
||||||
"mkstemp",
|
"mkstemp",
|
||||||
@@ -306,8 +381,10 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
{
|
{
|
||||||
"cppcoreguidelines-",
|
"cppcoreguidelines-",
|
||||||
{
|
{
|
||||||
|
"avoid-goto",
|
||||||
"c-copy-assignment-signature",
|
"c-copy-assignment-signature",
|
||||||
"interfaces-global-init",
|
"interfaces-global-init",
|
||||||
|
"narrowing-conversions",
|
||||||
"no-malloc",
|
"no-malloc",
|
||||||
"owning-memory",
|
"owning-memory",
|
||||||
{
|
{
|
||||||
@@ -343,7 +420,12 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"fuchsia-",
|
"fuchsia-",
|
||||||
{
|
{
|
||||||
"default-arguments",
|
"default-arguments",
|
||||||
|
"header-anon-namespaces",
|
||||||
|
"multiple-inheritance",
|
||||||
"overloaded-operator",
|
"overloaded-operator",
|
||||||
|
"restrict-system-includes",
|
||||||
|
"statically-constructed-objects",
|
||||||
|
"trailing-return",
|
||||||
"virtual-inheritance"
|
"virtual-inheritance"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -375,7 +457,6 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"casting",
|
"casting",
|
||||||
"function-size",
|
"function-size",
|
||||||
"namespace-comments",
|
"namespace-comments",
|
||||||
"redundant-smartptr-get",
|
|
||||||
"todo"
|
"todo"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -383,7 +464,6 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"runtime-",
|
"runtime-",
|
||||||
{
|
{
|
||||||
"int",
|
"int",
|
||||||
"member-string-references",
|
|
||||||
"operator",
|
"operator",
|
||||||
"references"
|
"references"
|
||||||
}
|
}
|
||||||
@@ -393,6 +473,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
{
|
{
|
||||||
"hicpp-",
|
"hicpp-",
|
||||||
{
|
{
|
||||||
|
"avoid-goto",
|
||||||
"braces-around-statements",
|
"braces-around-statements",
|
||||||
"deprecated-headers",
|
"deprecated-headers",
|
||||||
"exception-baseclass",
|
"exception-baseclass",
|
||||||
@@ -401,6 +482,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"invalid-access-moved",
|
"invalid-access-moved",
|
||||||
"member-init",
|
"member-init",
|
||||||
"move-const-arg",
|
"move-const-arg",
|
||||||
|
"multiway-paths-covered",
|
||||||
"named-parameter",
|
"named-parameter",
|
||||||
"new-delete-operators",
|
"new-delete-operators",
|
||||||
{
|
{
|
||||||
@@ -449,62 +531,19 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"misc-",
|
"misc-",
|
||||||
{
|
{
|
||||||
"definitions-in-headers",
|
"definitions-in-headers",
|
||||||
"forwarding-reference-overload",
|
"misplaced-const",
|
||||||
"incorrect-roundings",
|
|
||||||
"lambda-function-name",
|
|
||||||
{
|
|
||||||
"macro-",
|
|
||||||
{
|
|
||||||
"parentheses",
|
|
||||||
"repeated-side-effects"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"misplaced-",
|
|
||||||
{
|
|
||||||
"const",
|
|
||||||
"widening-cast"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"new-delete-overloads",
|
"new-delete-overloads",
|
||||||
"non-copyable-objects",
|
"non-copyable-objects",
|
||||||
"redundant-expression",
|
"redundant-expression",
|
||||||
{
|
|
||||||
"sizeof-",
|
|
||||||
{
|
|
||||||
"container",
|
|
||||||
"expression"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"static-assert",
|
"static-assert",
|
||||||
{
|
|
||||||
"string-",
|
|
||||||
{
|
|
||||||
"compare",
|
|
||||||
"integer-assignment",
|
|
||||||
"literal-with-embedded-nul"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"suspicious-",
|
|
||||||
{
|
|
||||||
"enum-usage",
|
|
||||||
"missing-comma",
|
|
||||||
"semicolon",
|
|
||||||
"string-compare"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"swapped-arguments",
|
|
||||||
"throw-by-value-catch-by-reference",
|
"throw-by-value-catch-by-reference",
|
||||||
"unconventional-assign-operator",
|
"unconventional-assign-operator",
|
||||||
"undelegated-constructor",
|
|
||||||
"uniqueptr-reset-release",
|
"uniqueptr-reset-release",
|
||||||
{
|
{
|
||||||
"unused-",
|
"unused-",
|
||||||
{
|
{
|
||||||
"alias-decls",
|
"alias-decls",
|
||||||
"parameters",
|
"parameters",
|
||||||
"raii",
|
|
||||||
"using-decls"
|
"using-decls"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -554,6 +593,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"nullptr",
|
"nullptr",
|
||||||
"override",
|
"override",
|
||||||
"transparent-functors",
|
"transparent-functors",
|
||||||
|
"uncaught-exceptions",
|
||||||
"using"
|
"using"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -609,7 +649,8 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"copy-initialization",
|
"copy-initialization",
|
||||||
"value-param"
|
"value-param"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"simd-intrinsics"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -646,7 +687,13 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"simplify-boolean-expr",
|
{
|
||||||
|
"simplify-",
|
||||||
|
{
|
||||||
|
"boolean-expr",
|
||||||
|
"subscript-expr"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"static-",
|
"static-",
|
||||||
{
|
{
|
||||||
@@ -654,7 +701,9 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT
|
|||||||
"definition-in-anonymous-namespace"
|
"definition-in-anonymous-namespace"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"uniqueptr-delete-release"
|
"string-compare",
|
||||||
|
"uniqueptr-delete-release",
|
||||||
|
"rary-objects"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,11 @@ public:
|
|||||||
const clang::FileEntry *file,
|
const clang::FileEntry *file,
|
||||||
llvm::StringRef /*searchPath*/,
|
llvm::StringRef /*searchPath*/,
|
||||||
llvm::StringRef /*relativePath*/,
|
llvm::StringRef /*relativePath*/,
|
||||||
const clang::Module * /*imported*/) override
|
const clang::Module * /*imported*/
|
||||||
|
#if LLVM_VERSION_MAJOR >= 7
|
||||||
|
, clang::SrcMgr::CharacteristicKind /*fileType*/
|
||||||
|
#endif
|
||||||
|
) override
|
||||||
{
|
{
|
||||||
if (!m_skipInclude && file) {
|
if (!m_skipInclude && file) {
|
||||||
auto fileUID = file->getUID();
|
auto fileUID = file->getUID();
|
||||||
|
|||||||
@@ -196,7 +196,11 @@ public:
|
|||||||
const clang::FileEntry *file,
|
const clang::FileEntry *file,
|
||||||
llvm::StringRef /*searchPath*/,
|
llvm::StringRef /*searchPath*/,
|
||||||
llvm::StringRef /*relativePath*/,
|
llvm::StringRef /*relativePath*/,
|
||||||
const clang::Module * /*imported*/) override
|
const clang::Module * /*imported*/
|
||||||
|
#if LLVM_VERSION_MAJOR >= 7
|
||||||
|
, clang::SrcMgr::CharacteristicKind /*fileType*/
|
||||||
|
#endif
|
||||||
|
) override
|
||||||
{
|
{
|
||||||
if (!m_skipInclude && file)
|
if (!m_skipInclude && file)
|
||||||
addSourceDependency(file, hashLocation);
|
addSourceDependency(file, hashLocation);
|
||||||
|
|||||||
@@ -95,7 +95,11 @@ public:
|
|||||||
const clang::FileEntry *file,
|
const clang::FileEntry *file,
|
||||||
llvm::StringRef /*searchPath*/,
|
llvm::StringRef /*searchPath*/,
|
||||||
llvm::StringRef /*relativePath*/,
|
llvm::StringRef /*relativePath*/,
|
||||||
const clang::Module * /*imported*/) override
|
const clang::Module * /*imported*/
|
||||||
|
#if LLVM_VERSION_MAJOR >= 7
|
||||||
|
, clang::SrcMgr::CharacteristicKind /*fileType*/
|
||||||
|
#endif
|
||||||
|
) override
|
||||||
{
|
{
|
||||||
if (!m_skipInclude && file)
|
if (!m_skipInclude && file)
|
||||||
addSourceDependency(file, hashLocation);
|
addSourceDependency(file, hashLocation);
|
||||||
|
|||||||
@@ -127,8 +127,12 @@ bool IndexDataConsumer::skipSymbol(clang::FileID fileId, clang::index::SymbolRol
|
|||||||
bool IndexDataConsumer::handleDeclOccurence(const clang::Decl *declaration,
|
bool IndexDataConsumer::handleDeclOccurence(const clang::Decl *declaration,
|
||||||
clang::index::SymbolRoleSet symbolRoles,
|
clang::index::SymbolRoleSet symbolRoles,
|
||||||
llvm::ArrayRef<clang::index::SymbolRelation> symbolRelations,
|
llvm::ArrayRef<clang::index::SymbolRelation> symbolRelations,
|
||||||
|
#if LLVM_VERSION_MAJOR >= 7
|
||||||
|
clang::SourceLocation sourceLocation,
|
||||||
|
#else
|
||||||
clang::FileID fileId,
|
clang::FileID fileId,
|
||||||
unsigned offset,
|
unsigned offset,
|
||||||
|
#endif
|
||||||
IndexDataConsumer::ASTNodeInfo astNodeInfo)
|
IndexDataConsumer::ASTNodeInfo astNodeInfo)
|
||||||
{
|
{
|
||||||
const auto *namedDeclaration = clang::dyn_cast<clang::NamedDecl>(declaration);
|
const auto *namedDeclaration = clang::dyn_cast<clang::NamedDecl>(declaration);
|
||||||
@@ -136,11 +140,17 @@ bool IndexDataConsumer::handleDeclOccurence(const clang::Decl *declaration,
|
|||||||
if (!namedDeclaration->getIdentifier())
|
if (!namedDeclaration->getIdentifier())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
#if LLVM_VERSION_MAJOR >= 7
|
||||||
|
if (skipSymbol(m_sourceManager->getFileID(sourceLocation), symbolRoles))
|
||||||
|
#else
|
||||||
if (skipSymbol(fileId, symbolRoles))
|
if (skipSymbol(fileId, symbolRoles))
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
SymbolIndex globalId = toSymbolIndex(declaration->getCanonicalDecl());
|
SymbolIndex globalId = toSymbolIndex(declaration->getCanonicalDecl());
|
||||||
|
#if LLVM_VERSION_MAJOR < 7
|
||||||
clang::SourceLocation sourceLocation = m_sourceManager->getLocForStartOfFile(fileId).getLocWithOffset(offset);
|
clang::SourceLocation sourceLocation = m_sourceManager->getLocForStartOfFile(fileId).getLocWithOffset(offset);
|
||||||
|
#endif
|
||||||
|
|
||||||
auto found = m_symbolEntries.find(globalId);
|
auto found = m_symbolEntries.find(globalId);
|
||||||
if (found == m_symbolEntries.end()) {
|
if (found == m_symbolEntries.end()) {
|
||||||
|
|||||||
@@ -55,8 +55,12 @@ public:
|
|||||||
bool handleDeclOccurence(const clang::Decl *declaration,
|
bool handleDeclOccurence(const clang::Decl *declaration,
|
||||||
clang::index::SymbolRoleSet symbolRoles,
|
clang::index::SymbolRoleSet symbolRoles,
|
||||||
llvm::ArrayRef<clang::index::SymbolRelation> symbolRelations,
|
llvm::ArrayRef<clang::index::SymbolRelation> symbolRelations,
|
||||||
|
#if LLVM_VERSION_MAJOR >= 7
|
||||||
|
clang::SourceLocation sourceLocation,
|
||||||
|
#else
|
||||||
clang::FileID fileId,
|
clang::FileID fileId,
|
||||||
unsigned offset,
|
unsigned offset,
|
||||||
|
#endif
|
||||||
ASTNodeInfo astNodeInfo) override;
|
ASTNodeInfo astNodeInfo) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user