Clang: Fix mingw libclang build

Mingw miscompiles one of the static variables
in Clang-Tidy which results in clang driver
wrong return codes. Making it a local variable
solves the issue.

Change-Id: Ic834419e30bd45bbe728ffeb46181692c802fa06
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-04-23 09:44:12 +02:00
parent da47a92611
commit 5df7c12c5e

View File

@@ -35,3 +35,26 @@ index 9f37c428ff..475c5f84c0 100644
+// This anchor is used to force the linker to link the clazy plugin.
+extern volatile int ClazyPluginAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ClazyPluginAnchorDestination = ClazyPluginAnchorSource;
diff --git a/tools/clang/tools/extra/clang-tidy/modernize/LoopConvertCheck.cpp b/tools/clang/tools/extra/clang-tidy/modernize/LoopConvertCheck.cpp
index 54bf941f..49fabe9f 100644
--- a/tools/clang/tools/extra/clang-tidy/modernize/LoopConvertCheck.cpp
+++ b/tools/clang/tools/extra/clang-tidy/modernize/LoopConvertCheck.cpp
@@ -44,9 +44,6 @@ static const char EndVarName[] = "endVar";
static const char DerefByValueResultName[] = "derefByValueResult";
static const char DerefByRefResultName[] = "derefByRefResult";
-// shared matchers
-static const TypeMatcher AnyType = anything();
-
static const StatementMatcher IntegerComparisonMatcher =
expr(ignoringParenImpCasts(
declRefExpr(to(varDecl(hasType(isInteger())).bind(ConditionVarName)))));
@@ -173,6 +170,8 @@ StatementMatcher makeIteratorLoopMatcher() {
qualType(unless(hasCanonicalType(rValueReferenceType())))
.bind(DerefByRefResultName)))))));
+ static const TypeMatcher AnyType = anything();
+
return forStmt(
unless(isInTemplateInstantiation()),
hasLoopInit(anyOf(declStmt(declCountIs(2),