diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-01-14 22:31:31 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-01-14 22:31:31 +0000 |
commit | f0335171b4908939bac410f865fc09ceb06ac632 (patch) | |
tree | 673cdd0fc95cf3ad8cc5fc57c85c368c8bc8d7ce /lib/Driver/Tools.cpp | |
parent | 02fff572fdba94b31d8da0c538cb758380384b3b (diff) |
Driver: tweak handling of '--analyze' to invoke
analyzer -cc1 options that are tailored to the
input type. If the input type is "C++", we should
only run the dead stores checker (for now). Similarly,
checks specific to Objective-C should only run
on Objective-C Code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 50f32958d5..ba2d32328c 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -901,17 +901,32 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // Add default argument set. if (!Args.hasArg(options::OPT__analyzer_no_default_checks)) { + types::ID InputType = Inputs[0].getType(); + + // Checks to perform for all language types. CmdArgs.push_back("-analyzer-check-dead-stores"); - // Do not enable the security-syntatic check since it - // it needs to be refined (known issues). - // CmdArgs.push_back("-analyzer-check-security-syntactic"); - CmdArgs.push_back("-analyzer-check-objc-mem"); - CmdArgs.push_back("-analyzer-eagerly-assume"); - CmdArgs.push_back("-analyzer-check-objc-methodsigs"); - // Do not enable the missing -dealloc check. - // '-analyzer-check-objc-missing-dealloc', - CmdArgs.push_back("-analyzer-check-objc-unused-ivars"); - CmdArgs.push_back("-analyzer-check-idempotent-operations"); + + // Checks to perform for Objective-C/Objective-C++. + if (types::isObjC(InputType)) { + CmdArgs.push_back("-analyzer-check-objc-methodsigs"); + CmdArgs.push_back("-analyzer-check-objc-unused-ivars"); + // Do not enable the missing -dealloc check. + // '-analyzer-check-objc-missing-dealloc', + } + + // Checks to perform for all languages *except* C++. + if (!types::isCXX(InputType)) { + // Do not enable the security-syntatic check since it + // it needs to be refined (known issues). + // CmdArgs.push_back("-analyzer-check-security-syntactic"); + + // NOTE: Leaving -analyzer-check-objc-mem here is intentional. + // It also checks C code. + CmdArgs.push_back("-analyzer-check-objc-mem"); + + CmdArgs.push_back("-analyzer-eagerly-assume"); + CmdArgs.push_back("-analyzer-check-idempotent-operations"); + } } // Set the output format. The default is plist, for (lame) historical |