[analyzer][NFC] Fix some incorrect uses of -analyzer-config options
I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-config option is given from
the command line, and be able to list them all.
In this patch, I found some flags that should've been used as checker options,
or have absolutely no mention of in AnalyzerOptions, or are nonexistent.
- NonLocalizedStringChecker now uses its "AggressiveReport" flag as a checker
option
- lib/StaticAnalyzer/Frontend/ModelInjector.cpp now accesses the "model-path"
option through a getter in AnalyzerOptions
- -analyzer-config path-diagnostics-alternate=false is not a thing, I removed it,
- lib/StaticAnalyzer/Checkers/AllocationDiagnostics.cpp and
lib/StaticAnalyzer/Checkers/AllocationDiagnostics.h are weird, they actually
only contain an option getter. I deleted them, and fixed RetainCountChecker
to get it's "leak-diagnostics-reference-allocation" option as a checker option,
- "region-store-small-struct-limit" has a proper getter now.
Differential Revision: https://reviews.llvm.org/D53276
llvm-svn: 345985
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
index 388c2ea..3c50763 100644
--- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
+++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
@@ -16,7 +16,6 @@
#define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_RETAINCOUNTCHECKER_H
#include "../ClangSACheckers.h"
-#include "../AllocationDiagnostics.h"
#include "RetainCountDiagnostics.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclCXX.h"
@@ -266,25 +265,18 @@
mutable std::unique_ptr<RetainSummaryManager> Summaries;
mutable SummaryLogTy SummaryLog;
- AnalyzerOptions &Options;
mutable bool ShouldResetSummaryLog;
+public:
/// Optional setting to indicate if leak reports should include
/// the allocation line.
- mutable bool IncludeAllocationLine;
+ bool IncludeAllocationLine;
+ bool ShouldCheckOSObjectRetainCount;
-public:
- RetainCountChecker(AnalyzerOptions &Options)
- : Options(Options), ShouldResetSummaryLog(false),
- IncludeAllocationLine(
- shouldIncludeAllocationSiteInLeakDiagnostics(Options)) {}
+ RetainCountChecker() : ShouldResetSummaryLog(false) {}
~RetainCountChecker() override { DeleteContainerSeconds(DeadSymbolTags); }
- bool shouldCheckOSObjectRetainCount() const {
- return Options.getBooleanOption("CheckOSObject", true, this);
- }
-
void checkEndAnalysis(ExplodedGraph &G, BugReporter &BR,
ExprEngine &Eng) const {
// FIXME: This is a hack to make sure the summary log gets cleared between
@@ -339,7 +331,7 @@
bool ARCEnabled = (bool)Ctx.getLangOpts().ObjCAutoRefCount;
if (!Summaries) {
Summaries.reset(new RetainSummaryManager(
- Ctx, ARCEnabled, shouldCheckOSObjectRetainCount()));
+ Ctx, ARCEnabled, ShouldCheckOSObjectRetainCount));
} else {
assert(Summaries->isARCEnabled() == ARCEnabled);
}