]> granicus.if.org Git - clang/commitdiff
[driver] Enable some static analyzer "unix" checkers on Windows.
authorDevin Coughlin <dcoughlin@apple.com>
Thu, 21 Jan 2016 20:09:49 +0000 (20:09 +0000)
committerDevin Coughlin <dcoughlin@apple.com>
Thu, 21 Jan 2016 20:09:49 +0000 (20:09 +0000)
Many of the "unix" checkers are not actually unix-specific and would be valuable
to run on Windows. This commit explicitly enables those checkers on
Windows.

A patch by Alexander Riccio!

Differential Revision: http://reviews.llvm.org/D16245

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258426 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp

index b440d4c0ee8aefce83830a0a178bfe2003c32012..24a726b6ec7f6e014224355c4d2cee08d9b42f03 100644 (file)
@@ -3642,8 +3642,17 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     if (!Args.hasArg(options::OPT__analyzer_no_default_checks)) {
       CmdArgs.push_back("-analyzer-checker=core");
 
-      if (!IsWindowsMSVC)
-        CmdArgs.push_back("-analyzer-checker=unix");
+    if (!IsWindowsMSVC) {
+      CmdArgs.push_back("-analyzer-checker=unix");
+    } else {
+      // Enable "unix" checkers that also work on Windows.
+      CmdArgs.push_back("-analyzer-checker=unix.API");
+      CmdArgs.push_back("-analyzer-checker=unix.Malloc");
+      CmdArgs.push_back("-analyzer-checker=unix.MallocSizeof");
+      CmdArgs.push_back("-analyzer-checker=unix.MismatchedDeallocator");
+      CmdArgs.push_back("-analyzer-checker=unix.cstring.BadSizeArg");
+      CmdArgs.push_back("-analyzer-checker=unix.cstring.NullArg");
+    }
 
       // Disable some unix checkers for PS4.
       if (IsPS4CPU) {