[clang-tools-extra] r194807 - Always add core checkers if static analyzer checks are enabled.

Manuel Klimek klimek at google.com
Fri Nov 15 03:19:56 PST 2013


Author: klimek
Date: Fri Nov 15 05:19:56 2013
New Revision: 194807

URL: http://llvm.org/viewvc/llvm-project?rev=194807&view=rev
Log:
Always add core checkers if static analyzer checks are enabled.

In response to post-commit feedback by Jordan, this is required to
make sure path-sensitive checks work correctly.

Modified:
    clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=194807&r1=194806&r2=194807&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Fri Nov 15 05:19:56 2013
@@ -98,12 +98,19 @@ private:
     AnalyzerOptionsRef Options = Compiler.getAnalyzerOpts();
     llvm::Regex CheckRegex(CheckRegexString);
 
+    // Always add all core checkers if any other static analyzer checks are
+    // enabled. This is currently necessary, as other path sensitive checks rely
+    // on the core checkers.
+    if (CheckRegex.match("clang-analyzer-"))
+      Options->CheckersControlList.push_back(std::make_pair("core", true));
+
 // Run our regex against all possible static analyzer checkers.
 // Note that debug checkers print values / run programs to visualize the CFG
 // and are thus not applicable to clang-tidy in general.
 #define GET_CHECKERS
 #define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN)       \
-  if (!StringRef(FULLNAME).startswith("debug") &&                              \
+  if (!StringRef(FULLNAME).startswith("core") &&                               \
+      !StringRef(FULLNAME).startswith("debug") &&                              \
       CheckRegex.match("clang-analyzer-" FULLNAME))                            \
     Options->CheckersControlList.push_back(std::make_pair(FULLNAME, true));
 #include "../../../lib/StaticAnalyzer/Checkers/Checkers.inc"





More information about the cfe-commits mailing list