From: George Karpenkov Date: Tue, 26 Jun 2018 23:10:05 +0000 (+0000) Subject: [analyzer] Minor cleanups for BugReporter, expose a getter for AnalyzerOptions. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b4bc5a9541197e57a3f26a4590898ea6d1d7372b;p=clang [analyzer] Minor cleanups for BugReporter, expose a getter for AnalyzerOptions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335683 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h index 9f0a83d255..111e1d1e8e 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -519,10 +519,6 @@ public: ~GRBugReporter() override; - /// getEngine - Return the analysis engine used to analyze a given - /// function or method. - ExprEngine &getEngine() { return Eng; } - /// getGraph - Get the exploded graph created by the analysis engine /// for the analyzed method or function. ExplodedGraph &getGraph(); @@ -590,6 +586,10 @@ public: return BR.getSourceManager(); } + AnalyzerOptions &getAnalyzerOptions() { + return BR.getAnalyzerOptions(); + } + NodeMapClosure& getNodeResolver() { return NMC; } }; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h index e469df0d15..3c0ab4d752 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h @@ -537,7 +537,7 @@ public: void evalEagerlyAssumeBinOpBifurcation(ExplodedNodeSet &Dst, ExplodedNodeSet &Src, const Expr *Ex); - std::pair + static std::pair geteagerlyAssumeBinOpBifurcationTags(); SVal evalMinus(SVal X) { diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index cd13412301..a4ac93d59b 100644 --- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -769,8 +769,7 @@ public: // If we have counter-suppression enabled, make sure we keep visiting // future nodes. We want to emit a path note as well, in case // the report is resurrected as valid later on. - ExprEngine &Eng = BRC.getBugReporter().getEngine(); - AnalyzerOptions &Options = Eng.getAnalysisManager().options; + AnalyzerOptions &Options = BRC.getAnalyzerOptions(); if (EnableNullFPSuppression && hasCounterSuppression(Options)) Mode = MaybeUnsuppress; @@ -808,8 +807,7 @@ public: visitNodeMaybeUnsuppress(const ExplodedNode *N, const ExplodedNode *PrevN, BugReporterContext &BRC, BugReport &BR) { #ifndef NDEBUG - ExprEngine &Eng = BRC.getBugReporter().getEngine(); - AnalyzerOptions &Options = Eng.getAnalysisManager().options; + AnalyzerOptions &Options = BRC.getAnalyzerOptions(); assert(hasCounterSuppression(Options)); #endif @@ -1756,11 +1754,8 @@ ConditionBRVisitor::VisitNodeImpl(const ExplodedNode *N, } if (Optional PS = progPoint.getAs()) { - // FIXME: Assuming that BugReporter is a GRBugReporter is a layering - // violation. const std::pair &tags = - cast(BRC.getBugReporter()). - getEngine().geteagerlyAssumeBinOpBifurcationTags(); + ExprEngine::geteagerlyAssumeBinOpBifurcationTags(); const ProgramPointTag *tag = PS->getTag(); if (tag == tags.first) @@ -2152,8 +2147,7 @@ void LikelyFalsePositiveSuppressionBRVisitor::finalizeVisitor( BugReporterContext &BRC, const ExplodedNode *N, BugReport &BR) { // Here we suppress false positives coming from system headers. This list is // based on known issues. - ExprEngine &Eng = BRC.getBugReporter().getEngine(); - AnalyzerOptions &Options = Eng.getAnalysisManager().options; + AnalyzerOptions &Options = BRC.getAnalyzerOptions(); const Decl *D = N->getLocationContext()->getDecl(); if (AnalysisDeclContext::isInStdNamespace(D)) {