]> granicus.if.org Git - clang/commitdiff
[analyzer] Minor cleanups for BugReporter, expose a getter for AnalyzerOptions.
authorGeorge Karpenkov <ekarpenkov@apple.com>
Tue, 26 Jun 2018 23:10:05 +0000 (23:10 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Tue, 26 Jun 2018 23:10:05 +0000 (23:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335683 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
lib/StaticAnalyzer/Core/BugReporterVisitors.cpp

index 9f0a83d255b7d4a6edf2e94cc40ac997b8354a50..111e1d1e8e20af7af782bb2117ee73531ddc6756 100644 (file)
@@ -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; }
 };
 
index e469df0d15e448906868fd4c4de8a64edc36e752..3c0ab4d7520fdfd836bf7189bf70686d209a53a5 100644 (file)
@@ -537,7 +537,7 @@ public:
   void evalEagerlyAssumeBinOpBifurcation(ExplodedNodeSet &Dst, ExplodedNodeSet &Src, 
                          const Expr *Ex);
   
-  std::pair<const ProgramPointTag *, const ProgramPointTag *>
+  static std::pair<const ProgramPointTag *, const ProgramPointTag *>
     geteagerlyAssumeBinOpBifurcationTags();
 
   SVal evalMinus(SVal X) {
index cd13412301599d453e612e4eb89449b80fdb7067..a4ac93d59b3f770194a4c8d9f0d1d4030eca0dac 100644 (file)
@@ -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<PostStmt> PS = progPoint.getAs<PostStmt>()) {
-    // FIXME: Assuming that BugReporter is a GRBugReporter is a layering
-    // violation.
     const std::pair<const ProgramPointTag *, const ProgramPointTag *> &tags =
-      cast<GRBugReporter>(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)) {