From: Devin Coughlin Date: Thu, 21 Jan 2016 20:09:49 +0000 (+0000) Subject: [driver] Enable some static analyzer "unix" checkers on Windows. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=497108d3a73d1b7ce538a0d9fd6d2c07c55d5579;p=clang [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258426 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index b440d4c0ee..24a726b6ec 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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) {