diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-02-14 18:13:31 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-02-14 18:13:31 +0000 |
commit | 556c45e9c5ff293a9cf4136f4fe8b8592bab992a (patch) | |
tree | 314015c9dc39868f7e7efb5565ef12d07e87e285 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 4ec3cf99371e55ecb261c32fc28859fe90183b7b (diff) | |
download | bcm5719-llvm-556c45e9c5ff293a9cf4136f4fe8b8592bab992a.tar.gz bcm5719-llvm-556c45e9c5ff293a9cf4136f4fe8b8592bab992a.zip |
[analyzer] Overhauling of the checker registration mechanism.
-Checkers will be defined in the tablegen file 'Checkers.td'.
-Apart from checkers, we can define checker "packages" that will contain a collection of checkers.
-Checkers can be enabled with -analyzer-checker=<name> and disabled with -analyzer-disable-checker=<name> e.g:
Enable checkers from 'cocoa' and 'corefoundation' packages except the self-initialization checker:
-analyzer-checker=cocoa -analyzer-checker=corefoundation -analyzer-disable-checker=cocoa.SelfInit
-Introduces CheckerManager and CheckerProvider. CheckerProviders get the set of checker names to enable/disable and
register them with the CheckerManager which will be the entry point for all checker-related functionality.
Currently only the self-initialization checker takes advantage of the new mechanism.
llvm-svn: 125503
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 229ea504abb..13466f54290 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -118,10 +118,17 @@ static void AnalyzerOptsToArgs(const AnalyzerOptions &Opts, Res.push_back("-analyzer-experimental-internal-checks"); if (Opts.IdempotentOps) Res.push_back("-analyzer-check-idempotent-operations"); - if (Opts.ObjCSelfInitCheck) - Res.push_back("-analyzer-check-objc-self-init"); if (Opts.BufferOverflows) Res.push_back("-analyzer-check-buffer-overflows"); + + for (unsigned i = 0, e = Opts.CheckersControlList.size(); i != e; ++i) { + const std::pair<std::string, bool> &opt = Opts.CheckersControlList[i]; + if (opt.second) + Res.push_back("-analyzer-disable-checker"); + else + Res.push_back("-analyzer-checker"); + Res.push_back(opt.first); + } } static void CodeGenOptsToArgs(const CodeGenOptions &Opts, @@ -885,8 +892,18 @@ static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, Opts.EagerlyTrimEGraph = !Args.hasArg(OPT_analyzer_no_eagerly_trim_egraph); Opts.InlineCall = Args.hasArg(OPT_analyzer_inline_call); Opts.IdempotentOps = Args.hasArg(OPT_analysis_WarnIdempotentOps); - Opts.ObjCSelfInitCheck = Args.hasArg(OPT_analysis_WarnObjCSelfInit); Opts.BufferOverflows = Args.hasArg(OPT_analysis_WarnBufferOverflows); + + Opts.CheckersControlList.clear(); + for (arg_iterator it = Args.filtered_begin(OPT_analyzer_checker, + OPT_analyzer_disable_checker), + ie = Args.filtered_end(); it != ie; ++it) { + const Arg *A = *it; + A->claim(); + bool enable = (A->getOption().getID() == OPT_analyzer_checker); + Opts.CheckersControlList.push_back(std::make_pair(A->getValue(Args), + enable)); + } } static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, |