diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Driver/Tools.cpp | 1 | ||||
-rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 3 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Checkers/AnalysisConsumer.cpp | 3 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Checkers/ExprEngine.cpp | 1 |
4 files changed, 7 insertions, 1 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index e245f78870..90ed5d45ae 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -910,6 +910,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (types::isObjC(InputType)) { CmdArgs.push_back("-analyzer-check-objc-methodsigs"); CmdArgs.push_back("-analyzer-check-objc-unused-ivars"); + CmdArgs.push_back("-analyzer-check-objc-self-init"); // Do not enable the missing -dealloc check. // '-analyzer-check-objc-missing-dealloc', } diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index c3f3dbd1f9..28cae64bff 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -118,6 +118,8 @@ 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"); } @@ -868,6 +870,7 @@ static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, Opts.MaxLoop = Args.getLastArgIntValue(OPT_analyzer_max_loop, 4, Diags); 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); } diff --git a/lib/StaticAnalyzer/Checkers/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Checkers/AnalysisConsumer.cpp index ae8732a857..9190e2d750 100644 --- a/lib/StaticAnalyzer/Checkers/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Checkers/AnalysisConsumer.cpp @@ -357,6 +357,9 @@ static void ActionExprEngine(AnalysisConsumer &C, AnalysisManager& mgr, if (C.Opts.EnableExperimentalChecks) RegisterExperimentalChecks(Eng); + if (C.Opts.ObjCSelfInitCheck && isa<ObjCMethodDecl>(D)) + registerObjCSelfInitChecker(Eng); + // Enable idempotent operation checking if it was explicitly turned on, or if // we are running experimental checks (i.e. everything) if (C.Opts.IdempotentOps || C.Opts.EnableExperimentalChecks diff --git a/lib/StaticAnalyzer/Checkers/ExprEngine.cpp b/lib/StaticAnalyzer/Checkers/ExprEngine.cpp index f311bea877..8ad094b1d3 100644 --- a/lib/StaticAnalyzer/Checkers/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Checkers/ExprEngine.cpp @@ -309,7 +309,6 @@ static void RegisterInternalChecks(ExprEngine &Eng) { RegisterUndefResultChecker(Eng); RegisterStackAddrLeakChecker(Eng); RegisterObjCAtSyncChecker(Eng); - registerObjCSelfInitChecker(Eng); // This is not a checker yet. RegisterNoReturnFunctionChecker(Eng); |