r258426 - [driver] Enable some static analyzer "unix" checkers on Windows.

Devin Coughlin via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 21 12:09:49 PST 2016


Author: dcoughlin
Date: Thu Jan 21 14:09:49 2016
New Revision: 258426

URL: http://llvm.org/viewvc/llvm-project?rev=258426&view=rev
Log:
[driver] Enable some static analyzer "unix" checkers on Windows.

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

Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=258426&r1=258425&r2=258426&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Jan 21 14:09:49 2016
@@ -3642,8 +3642,17 @@ void Clang::ConstructJob(Compilation &C,
     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) {




More information about the cfe-commits mailing list