From 5df7c12c5e7dc9cf76fa24808f121c7969992542 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 23 Apr 2018 09:44:12 +0200 Subject: [PATCH] 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 --- dist/clang/patches/240_Link-clang-tools.patch | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dist/clang/patches/240_Link-clang-tools.patch b/dist/clang/patches/240_Link-clang-tools.patch index 3a07e0a70a6..0c2464d8402 100644 --- a/dist/clang/patches/240_Link-clang-tools.patch +++ b/dist/clang/patches/240_Link-clang-tools.patch @@ -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),