kazu created this revision.
Herald added subscribers: abrachet, manas, ASDenysPetrov, martong, dkrupp, 
donat.nagy, Szelethus, a.sidorin, zzheng, szepet, baloghadamsoftware.
Herald added a project: All.
kazu requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

DO NOT COMMIT!  This untested patch deletes dead code under
clang/lib/StaticAnalyzer, including debug functions.  Please
intelligently choose what to actually remove.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127799

Files:
  clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
  clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
  clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp
  clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
  clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/Iterator.h
  clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
  clang/lib/StaticAnalyzer/Core/BugReporter.cpp
  clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
  clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  clang/lib/StaticAnalyzer/Core/RegionStore.cpp
  clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
  clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Index: clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -352,7 +352,6 @@
 
 private:
   void storeTopLevelDecls(DeclGroupRef DG);
-  std::string getFunctionName(const Decl *D);
 
   /// Check if we should skip (not analyze) the given function.
   AnalysisMode getModeForDecl(Decl *D, AnalysisMode Mode);
Index: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -1352,10 +1352,6 @@
           S, SVB.evalUnaryOp(State, S->getOpcode(), Op, S->getType()));
     }
 
-    SVal VisitSymExpr(SymbolRef S) { return nonloc::SymbolVal(S); }
-
-    SVal VisitMemRegion(const MemRegion *R) { return loc::MemRegionVal(R); }
-
     SVal VisitNonLocSymbolVal(nonloc::SymbolVal V) {
       // Simplification is much more costly than computing complexity.
       // For high complexity, it may be not worth it.
Index: clang/lib/StaticAnalyzer/Core/RegionStore.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ clang/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -107,8 +107,6 @@
     return P.getOpaqueValue() == X.P.getOpaqueValue() &&
            Data == X.Data;
   }
-
-  LLVM_DUMP_METHOD void dump() const;
 };
 } // end anonymous namespace
 
@@ -136,7 +134,6 @@
 } // namespace llvm
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-void BindingKey::dump() const { llvm::errs() << *this; }
 #endif
 
 //===----------------------------------------------------------------------===//
@@ -255,8 +252,6 @@
       Out << NL;
     }
   }
-
-  LLVM_DUMP_METHOD void dump() const { printJson(llvm::errs()); }
 };
 } // end anonymous namespace
 
@@ -732,10 +727,6 @@
     return true;
   }
 
-  bool AddToWorkList(const MemRegion *R) {
-    return static_cast<DERIVED*>(this)->AddToWorkList(R);
-  }
-
   void RunWorkList() {
     while (!WL.empty()) {
       WorkListElement E = WL.pop_back_val();
@@ -746,7 +737,6 @@
   }
 
   void VisitAddedToCluster(const MemRegion *baseR, const ClusterBindings &C) {}
-  void VisitCluster(const MemRegion *baseR, const ClusterBindings *C) {}
 
   void VisitCluster(const MemRegion *BaseR, const ClusterBindings *C,
                     bool Flag) {
Index: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
@@ -954,8 +954,6 @@
   LLVM_NODISCARD inline ProgramStateRef
   markDisequal(RangeSet::Factory &F, ProgramStateRef State,
                EquivalenceClass Other) const;
-  LLVM_NODISCARD static inline ClassSet
-  getDisequalClasses(ProgramStateRef State, SymbolRef Sym);
   LLVM_NODISCARD inline ClassSet
   getDisequalClasses(ProgramStateRef State) const;
   LLVM_NODISCARD inline ClassSet
@@ -978,9 +976,6 @@
                                                         EquivalenceClass Class);
 
   void dumpToStream(ProgramStateRef State, raw_ostream &os) const;
-  LLVM_DUMP_METHOD void dump(ProgramStateRef State) const {
-    dumpToStream(State, llvm::errs());
-  }
 
   /// Check equivalence data for consistency.
   LLVM_NODISCARD LLVM_ATTRIBUTE_UNUSED static bool
@@ -1000,9 +995,6 @@
     return ID == Other.ID;
   }
   bool operator<(const EquivalenceClass &Other) const { return ID < Other.ID; }
-  bool operator!=(const EquivalenceClass &Other) const {
-    return !operator==(Other);
-  }
 
   static void Profile(llvm::FoldingSetNodeID &ID, uintptr_t CID) {
     ID.AddInteger(CID);
@@ -1851,11 +1843,8 @@
   RangeSet::Factory F;
 
   RangeSet getRange(ProgramStateRef State, SymbolRef Sym);
-  RangeSet getRange(ProgramStateRef State, EquivalenceClass Class);
   ProgramStateRef setRange(ProgramStateRef State, SymbolRef Sym,
                            RangeSet Range);
-  ProgramStateRef setRange(ProgramStateRef State, EquivalenceClass Class,
-                           RangeSet Range);
 
   RangeSet getSymLTRange(ProgramStateRef St, SymbolRef Sym,
                          const llvm::APSInt &Int,
@@ -2633,11 +2622,6 @@
   return State;
 }
 
-inline ClassSet EquivalenceClass::getDisequalClasses(ProgramStateRef State,
-                                                     SymbolRef Sym) {
-  return find(State, Sym).getDisequalClasses(State);
-}
-
 inline ClassSet
 EquivalenceClass::getDisequalClasses(ProgramStateRef State) const {
   return getDisequalClasses(State->get<DisequalityMap>(),
Index: clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
+++ clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
@@ -46,9 +46,6 @@
   unsigned getMaxStep() const { return maxStep; }
   const Stmt *getLoopStmt() const { return LoopStmt; }
   const LocationContext *getLocationContext() const { return LCtx; }
-  bool operator==(const LoopState &X) const {
-    return K == X.K && LoopStmt == X.LoopStmt;
-  }
   void Profile(llvm::FoldingSetNodeID &ID) const {
     ID.AddInteger(K);
     ID.AddPointer(LoopStmt);
Index: clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -123,13 +123,6 @@
 
   const ConstructedObjectKeyImpl Impl;
 
-  const void *getAnyASTNodePtr() const {
-    if (const Stmt *S = getItem().getStmtOrNull())
-      return S;
-    else
-      return getItem().getCXXCtorInitializer();
-  }
-
 public:
   explicit ConstructedObjectKey(const ConstructionContextItem &Item,
                        const LocationContext *LC)
Index: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -527,11 +527,6 @@
     ID.AddPointer(RegionOfInterest);
   }
 
-  void *getTag() const {
-    static int Tag = 0;
-    return static_cast<void *>(&Tag);
-  }
-
 private:
   /// \return Whether \c RegionOfInterest was modified at \p CurrN compared to
   /// the value it holds in \p CallExitBeginN.
Index: clang/lib/StaticAnalyzer/Core/BugReporter.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -167,10 +167,6 @@
 
   const SourceManager &getSourceManager() const { return SM; }
 
-  const Stmt *getParent(const Stmt *S) const {
-    return getParentMap().getParent(S);
-  }
-
   void updateLocCtxMap(const PathPieces *Path, const LocationContext *LC) {
     assert(Path && LC);
     LCM[Path] = LC;
@@ -191,9 +187,6 @@
   bool shouldAddControlNotes() const {
     return Consumer->shouldAddControlNotes();
   }
-  bool shouldGenerateDiagnostics() const {
-    return Consumer->shouldGenerateDiagnostics();
-  }
   bool supportsLogicalOpControlFlow() const {
     return Consumer->supportsLogicalOpControlFlow();
   }
Index: clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
@@ -43,8 +43,6 @@
   mutable Optional<uint64_t> Val_O_CREAT;
 
 public:
-  bool CheckMisuse = false, CheckPortability = false;
-
   void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;
 
   void CheckOpen(CheckerContext &C, const CallExpr *CE) const;
Index: clang/lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp
@@ -27,12 +27,6 @@
   mutable std::unique_ptr<BugType> BT;
   void initBugType() const;
 
-  /// Given a pointer argument, get the symbol of the value it contains
-  /// (points to).
-  SymbolRef getPointedToSymbol(CheckerContext &C,
-                               const Expr* Arg,
-                               bool IssueWarning = true) const;
-
 public:
   void checkPostStmt(const Expr *E, CheckerContext &C) const;
 };
Index: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -50,7 +50,6 @@
 
   bool isNoError() const { return NoError && !FEof && !FError; }
   bool isFEof() const { return !NoError && FEof && !FError; }
-  bool isFError() const { return !NoError && !FEof && FError; }
 
   bool operator==(const StreamErrorState &ES) const {
     return NoError == ES.NoError && FEof == ES.FEof && FError == ES.FError;
@@ -70,12 +69,6 @@
 
   /// Returns if the StreamErrorState is a valid object.
   operator bool() const { return NoError || FEof || FError; }
-
-  void Profile(llvm::FoldingSetNodeID &ID) const {
-    ID.AddBoolean(NoError);
-    ID.AddBoolean(FEof);
-    ID.AddBoolean(FError);
-  }
 };
 
 const StreamErrorState ErrorNone{true, false, false};
Index: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
+++ clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
@@ -50,7 +50,6 @@
   // Whether the checker should model for null dereferences of smart pointers.
   bool ModelSmartPtrDereference = false;
   bool evalCall(const CallEvent &Call, CheckerContext &C) const;
-  void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
   void checkDeadSymbols(SymbolReaper &SymReaper, CheckerContext &C) const;
   ProgramStateRef
   checkRegionChanges(ProgramStateRef State,
Index: clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
@@ -89,20 +89,6 @@
 /// state. Let's store it in the ProgramState.
 REGISTER_MAP_WITH_PROGRAMSTATE(StreamMap, SymbolRef, StreamState)
 
-namespace {
-class StopTrackingCallback final : public SymbolVisitor {
-  ProgramStateRef state;
-public:
-  StopTrackingCallback(ProgramStateRef st) : state(std::move(st)) {}
-  ProgramStateRef getState() const { return state; }
-
-  bool VisitSymbol(SymbolRef sym) override {
-    state = state->remove<StreamMap>(sym);
-    return true;
-  }
-};
-} // end anonymous namespace
-
 SimpleStreamChecker::SimpleStreamChecker()
     : OpenFn("fopen"), CloseFn("fclose", 1) {
   // Initialize the bug types.
Index: clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
@@ -47,9 +47,6 @@
                    CheckerContext &C) const;
 
 public:
-  /// A tag to id this checker.
-  static void *getTag() { static int Tag; return &Tag; }
-
   void checkPostStmt(const CallExpr *CE, CheckerContext &C) const;
   void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;
   ProgramStateRef checkPointerEscape(ProgramStateRef State,
Index: clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
@@ -49,7 +49,6 @@
     : public Checker<check::PreCall, check::PostCall,
                      check::DeadSymbols, check::RegionChanges> {
 public:
-  void checkEndFunction(const ReturnStmt *RS, CheckerContext &C) const;
   void checkPreCall(const CallEvent &MC, CheckerContext &C) const;
   void checkPostCall(const CallEvent &MC, CheckerContext &C) const;
   void checkDeadSymbols(SymbolReaper &SR, CheckerContext &C) const;
@@ -229,16 +228,6 @@
 REGISTER_MAP_WITH_PROGRAMSTATE(TrackedRegionMap, const MemRegion *, RegionState)
 
 // Define the inter-checker API.
-namespace clang {
-namespace ento {
-namespace move {
-bool isMovedFrom(ProgramStateRef State, const MemRegion *Region) {
-  const RegionState *RS = State->get<TrackedRegionMap>(Region);
-  return RS && (RS->isMoved() || RS->isReported());
-}
-} // namespace move
-} // namespace ento
-} // namespace clang
 
 // If a region is removed all of the subregions needs to be removed too.
 static ProgramStateRef removeFromState(ProgramStateRef State,
Index: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -206,8 +206,6 @@
     CASE(Escaped)
     }
   }
-
-  LLVM_DUMP_METHOD void dump() const { dump(llvm::errs()); }
 };
 
 } // end of anonymous namespace
@@ -767,7 +765,6 @@
       return true;
     }
 
-    LLVM_DUMP_METHOD void dump() const { dumpToStream(llvm::errs()); }
     LLVM_DUMP_METHOD void dumpToStream(llvm::raw_ostream &out) const {
       out << "Owners: {\n";
       for (const MemRegion *Owner : Owners) {
@@ -790,15 +787,6 @@
     return Ret;
   }
 
-  LLVM_DUMP_METHOD static std::string
-  getFunctionName(const ExplodedNode *CallEnterN) {
-    if (const CallExpr *CE = llvm::dyn_cast_or_null<CallExpr>(
-            CallEnterN->getLocationAs<CallEnter>()->getCallExpr()))
-      if (const FunctionDecl *FD = CE->getDirectCallee())
-        return FD->getQualifiedNameAsString();
-    return "";
-  }
-
   /// Syntactically checks whether the callee is a deallocating function. Since
   /// we have no path-sensitive information on this call (we would need a
   /// CallEvent instead of a CallExpr for that), its possible that a
@@ -927,11 +915,6 @@
     ID.AddPointer(&Tag);
     ID.AddPointer(Sym);
   }
-
-  void *getTag() const {
-    static int Tag = 0;
-    return static_cast<void *>(&Tag);
-  }
 };
 
 } // end anonymous namespace
Index: clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
+++ clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
@@ -151,8 +151,6 @@
   void checkBind(SVal Loc, SVal Val, const Stmt *S, CheckerContext &C) const;
   void checkPostStmt(const UnaryOperator *UO, CheckerContext &C) const;
   void checkPostStmt(const BinaryOperator *BO, CheckerContext &C) const;
-  void checkPostStmt(const CXXConstructExpr *CCE, CheckerContext &C) const;
-  void checkPostStmt(const DeclStmt *DS, CheckerContext &C) const;
   void checkPostStmt(const MaterializeTemporaryExpr *MTE,
                      CheckerContext &C) const;
   void checkLiveSymbols(ProgramStateRef State, SymbolReaper &SR) const;
Index: clang/lib/StaticAnalyzer/Checkers/Iterator.h
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/Iterator.h
+++ clang/lib/StaticAnalyzer/Checkers/Iterator.h
@@ -63,10 +63,6 @@
     return Cont == X.Cont && Valid == X.Valid && Offset == X.Offset;
   }
 
-  bool operator!=(const IteratorPosition &X) const {
-    return Cont != X.Cont || Valid != X.Valid || Offset != X.Offset;
-  }
-
   void Profile(llvm::FoldingSetNodeID &ID) const {
     ID.AddPointer(Cont);
     ID.AddInteger(Valid);
@@ -101,10 +97,6 @@
     return Begin == X.Begin && End == X.End;
   }
 
-  bool operator!=(const ContainerData &X) const {
-    return Begin != X.Begin || End != X.End;
-  }
-
   void Profile(llvm::FoldingSetNodeID &ID) const {
     ID.Add(Begin);
     ID.Add(End);
Index: clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -176,15 +176,6 @@
 
   bool isEmpty() const { return DiscreteArgs.empty() && !VariadicIndex; }
 
-  ArgVecTy ArgsUpTo(ArgIdxTy LastArgIdx) const {
-    ArgVecTy Args;
-    for (ArgIdxTy I = ReturnValueIndex; I <= LastArgIdx; ++I) {
-      if (contains(I))
-        Args.push_back(I);
-    }
-    return Args;
-  }
-
 private:
   ArgVecTy DiscreteArgs;
   Optional<ArgIdxTy> VariadicIndex;
@@ -340,11 +331,6 @@
 
 class GenericTaintChecker : public Checker<check::PreCall, check::PostCall> {
 public:
-  static void *getTag() {
-    static int Tag;
-    return &Tag;
-  }
-
   void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
   void checkPostCall(const CallEvent &Call, CheckerContext &C) const;
 
Index: clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
@@ -170,8 +170,6 @@
       ErrorSym->dumpToStream(OS);
     }
   }
-
-  LLVM_DUMP_METHOD void dump() const { dump(llvm::errs()); }
 };
 
 template <typename Attr> static bool hasFuchsiaAttr(const Decl *D) {
@@ -255,7 +253,6 @@
 class FuchsiaHandleSymbolVisitor final : public SymbolVisitor {
 public:
   FuchsiaHandleSymbolVisitor(ProgramStateRef State) : State(std::move(State)) {}
-  ProgramStateRef getState() const { return State; }
 
   bool VisitSymbol(SymbolRef S) override {
     if (const auto *HandleType = S->getType()->getAs<TypedefType>())
Index: clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
+++ clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
@@ -56,9 +56,6 @@
                     check::PreObjCMessage,
                     check::PostObjCMessage > {
 
-  const ObjCObjectType *getObjectTypeForAllocAndNew(const ObjCMessageExpr *MsgE,
-                                                    CheckerContext &C) const;
-
   /// Return a better dynamic type if one can be derived from the cast.
   const ObjCObjectPointerType *getBetterObjCType(const Expr *CastE,
                                                  CheckerContext &C) const;
Index: clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp
+++ clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp
@@ -24,311 +24,3 @@
 // All checkers should be placed into anonymous namespace.
 // We place the CheckerDocumentation inside ento namespace to make the
 // it visible in doxygen.
-namespace clang {
-namespace ento {
-
-/// This checker documents the callback functions checkers can use to implement
-/// the custom handling of the specific events during path exploration as well
-/// as reporting bugs. Most of the callbacks are targeted at path-sensitive
-/// checking.
-///
-/// \sa CheckerContext
-class CheckerDocumentation : public Checker< check::PreStmt<ReturnStmt>,
-                                       check::PostStmt<DeclStmt>,
-                                       check::PreObjCMessage,
-                                       check::PostObjCMessage,
-                                       check::ObjCMessageNil,
-                                       check::PreCall,
-                                       check::PostCall,
-                                       check::BranchCondition,
-                                       check::NewAllocator,
-                                       check::Location,
-                                       check::Bind,
-                                       check::DeadSymbols,
-                                       check::BeginFunction,
-                                       check::EndFunction,
-                                       check::EndAnalysis,
-                                       check::EndOfTranslationUnit,
-                                       eval::Call,
-                                       eval::Assume,
-                                       check::LiveSymbols,
-                                       check::RegionChanges,
-                                       check::PointerEscape,
-                                       check::ConstPointerEscape,
-                                       check::Event<ImplicitNullDerefEvent>,
-                                       check::ASTDecl<FunctionDecl> > {
-public:
-  /// Pre-visit the Statement.
-  ///
-  /// The method will be called before the analyzer core processes the
-  /// statement. The notification is performed for every explored CFGElement,
-  /// which does not include the control flow statements such as IfStmt. The
-  /// callback can be specialized to be called with any subclass of Stmt.
-  ///
-  /// See checkBranchCondition() callback for performing custom processing of
-  /// the branching statements.
-  ///
-  /// check::PreStmt<ReturnStmt>
-  void checkPreStmt(const ReturnStmt *DS, CheckerContext &C) const {}
-
-  /// Post-visit the Statement.
-  ///
-  /// The method will be called after the analyzer core processes the
-  /// statement. The notification is performed for every explored CFGElement,
-  /// which does not include the control flow statements such as IfStmt. The
-  /// callback can be specialized to be called with any subclass of Stmt.
-  ///
-  /// check::PostStmt<DeclStmt>
-  void checkPostStmt(const DeclStmt *DS, CheckerContext &C) const;
-
-  /// Pre-visit the Objective C message.
-  ///
-  /// This will be called before the analyzer core processes the method call.
-  /// This is called for any action which produces an Objective-C message send,
-  /// including explicit message syntax and property access.
-  ///
-  /// check::PreObjCMessage
-  void checkPreObjCMessage(const ObjCMethodCall &M, CheckerContext &C) const {}
-
-  /// Post-visit the Objective C message.
-  /// \sa checkPreObjCMessage()
-  ///
-  /// check::PostObjCMessage
-  void checkPostObjCMessage(const ObjCMethodCall &M, CheckerContext &C) const {}
-
-  /// Visit an Objective-C message whose receiver is nil.
-  ///
-  /// This will be called when the analyzer core processes a method call whose
-  /// receiver is definitely nil. In this case, check{Pre/Post}ObjCMessage and
-  /// check{Pre/Post}Call will not be called.
-  ///
-  /// check::ObjCMessageNil
-  void checkObjCMessageNil(const ObjCMethodCall &M, CheckerContext &C) const {}
-
-  /// Pre-visit an abstract "call" event.
-  ///
-  /// This is used for checkers that want to check arguments or attributed
-  /// behavior for functions and methods no matter how they are being invoked.
-  ///
-  /// Note that this includes ALL cross-body invocations, so if you want to
-  /// limit your checks to, say, function calls, you should test for that at the
-  /// beginning of your callback function.
-  ///
-  /// check::PreCall
-  void checkPreCall(const CallEvent &Call, CheckerContext &C) const {}
-
-  /// Post-visit an abstract "call" event.
-  /// \sa checkPreObjCMessage()
-  ///
-  /// check::PostCall
-  void checkPostCall(const CallEvent &Call, CheckerContext &C) const {}
-
-  /// Pre-visit of the condition statement of a branch (such as IfStmt).
-  void checkBranchCondition(const Stmt *Condition, CheckerContext &Ctx) const {}
-
-  /// Post-visit the C++ operator new's allocation call.
-  ///
-  /// Execution of C++ operator new consists of the following phases: (1) call
-  /// default or overridden operator new() to allocate memory (2) cast the
-  /// return value of operator new() from void pointer type to class pointer
-  /// type, (3) assuming that the value is non-null, call the object's
-  /// constructor over this pointer, (4) declare that the value of the
-  /// new-expression is this pointer. This callback is called between steps
-  /// (2) and (3). Post-call for the allocator is called after step (1).
-  /// Pre-statement for the new-expression is called on step (4) when the value
-  /// of the expression is evaluated.
-  /// \param NE     The C++ new-expression that triggered the allocation.
-  /// \param Target The allocated region, casted to the class type.
-  void checkNewAllocator(const CXXNewExpr *NE, SVal Target,
-                         CheckerContext &) const {}
-
-  /// Called on a load from and a store to a location.
-  ///
-  /// The method will be called each time a location (pointer) value is
-  /// accessed.
-  /// \param Loc    The value of the location (pointer).
-  /// \param IsLoad The flag specifying if the location is a store or a load.
-  /// \param S      The load is performed while processing the statement.
-  ///
-  /// check::Location
-  void checkLocation(SVal Loc, bool IsLoad, const Stmt *S,
-                     CheckerContext &) const {}
-
-  /// Called on binding of a value to a location.
-  ///
-  /// \param Loc The value of the location (pointer).
-  /// \param Val The value which will be stored at the location Loc.
-  /// \param S   The bind is performed while processing the statement S.
-  ///
-  /// check::Bind
-  void checkBind(SVal Loc, SVal Val, const Stmt *S, CheckerContext &) const {}
-
-  /// Called whenever a symbol becomes dead.
-  ///
-  /// This callback should be used by the checkers to aggressively clean
-  /// up/reduce the checker state, which is important for reducing the overall
-  /// memory usage. Specifically, if a checker keeps symbol specific information
-  /// in the state, it can and should be dropped after the symbol becomes dead.
-  /// In addition, reporting a bug as soon as the checker becomes dead leads to
-  /// more precise diagnostics. (For example, one should report that a malloced
-  /// variable is not freed right after it goes out of scope.)
-  ///
-  /// \param SR The SymbolReaper object can be queried to determine which
-  ///           symbols are dead.
-  ///
-  /// check::DeadSymbols
-  void checkDeadSymbols(SymbolReaper &SR, CheckerContext &C) const {}
-
-
-  /// Called when the analyzer core starts analyzing a function,
-  /// regardless of whether it is analyzed at the top level or is inlined.
-  ///
-  /// check::BeginFunction
-  void checkBeginFunction(CheckerContext &Ctx) const {}
-
-  /// Called when the analyzer core reaches the end of a
-  /// function being analyzed regardless of whether it is analyzed at the top
-  /// level or is inlined.
-  ///
-  /// check::EndFunction
-  void checkEndFunction(const ReturnStmt *RS, CheckerContext &Ctx) const {}
-
-  /// Called after all the paths in the ExplodedGraph reach end of path
-  /// - the symbolic execution graph is fully explored.
-  ///
-  /// This callback should be used in cases when a checker needs to have a
-  /// global view of the information generated on all paths. For example, to
-  /// compare execution summary/result several paths.
-  /// See IdempotentOperationChecker for a usage example.
-  ///
-  /// check::EndAnalysis
-  void checkEndAnalysis(ExplodedGraph &G,
-                        BugReporter &BR,
-                        ExprEngine &Eng) const {}
-
-  /// Called after analysis of a TranslationUnit is complete.
-  ///
-  /// check::EndOfTranslationUnit
-  void checkEndOfTranslationUnit(const TranslationUnitDecl *TU,
-                                 AnalysisManager &Mgr,
-                                 BugReporter &BR) const {}
-
-  /// Evaluates function call.
-  ///
-  /// The analysis core treats all function calls in the same way. However, some
-  /// functions have special meaning, which should be reflected in the program
-  /// state. This callback allows a checker to provide domain specific knowledge
-  /// about the particular functions it knows about.
-  ///
-  /// \returns true if the call has been successfully evaluated
-  /// and false otherwise. Note, that only one checker can evaluate a call. If
-  /// more than one checker claims that they can evaluate the same call the
-  /// first one wins.
-  ///
-  /// eval::Call
-  bool evalCall(const CallExpr *CE, CheckerContext &C) const { return true; }
-
-  /// Handles assumptions on symbolic values.
-  ///
-  /// This method is called when a symbolic expression is assumed to be true or
-  /// false. For example, the assumptions are performed when evaluating a
-  /// condition at a branch. The callback allows checkers track the assumptions
-  /// performed on the symbols of interest and change the state accordingly.
-  ///
-  /// eval::Assume
-  ProgramStateRef evalAssume(ProgramStateRef State,
-                                 SVal Cond,
-                                 bool Assumption) const { return State; }
-
-  /// Allows modifying SymbolReaper object. For example, checkers can explicitly
-  /// register symbols of interest as live. These symbols will not be marked
-  /// dead and removed.
-  ///
-  /// check::LiveSymbols
-  void checkLiveSymbols(ProgramStateRef State, SymbolReaper &SR) const {}
-
-  /// Called when the contents of one or more regions change.
-  ///
-  /// This can occur in many different ways: an explicit bind, a blanket
-  /// invalidation of the region contents, or by passing a region to a function
-  /// call whose behavior the analyzer cannot model perfectly.
-  ///
-  /// \param State The current program state.
-  /// \param Invalidated A set of all symbols potentially touched by the change.
-  /// \param ExplicitRegions The regions explicitly requested for invalidation.
-  ///        For a function call, this would be the arguments. For a bind, this
-  ///        would be the region being bound to.
-  /// \param Regions The transitive closure of regions accessible from,
-  ///        \p ExplicitRegions, i.e. all regions that may have been touched
-  ///        by this change. For a simple bind, this list will be the same as
-  ///        \p ExplicitRegions, since a bind does not affect the contents of
-  ///        anything accessible through the base region.
-  /// \param LCtx LocationContext that is useful for getting various contextual
-  ///        info, like callstack, CFG etc.
-  /// \param Call The opaque call triggering this invalidation. Will be 0 if the
-  ///        change was not triggered by a call.
-  ///
-  /// check::RegionChanges
-  ProgramStateRef
-    checkRegionChanges(ProgramStateRef State,
-                       const InvalidatedSymbols *Invalidated,
-                       ArrayRef<const MemRegion *> ExplicitRegions,
-                       ArrayRef<const MemRegion *> Regions,
-                       const LocationContext *LCtx,
-                       const CallEvent *Call) const {
-    return State;
-  }
-
-  /// Called when pointers escape.
-  ///
-  /// This notifies the checkers about pointer escape, which occurs whenever
-  /// the analyzer cannot track the symbol any more. For example, as a
-  /// result of assigning a pointer into a global or when it's passed to a
-  /// function call the analyzer cannot model.
-  ///
-  /// \param State The state at the point of escape.
-  /// \param Escaped The list of escaped symbols.
-  /// \param Call The corresponding CallEvent, if the symbols escape as
-  /// parameters to the given call.
-  /// \param Kind How the symbols have escaped.
-  /// \returns Checkers can modify the state by returning a new state.
-  ProgramStateRef checkPointerEscape(ProgramStateRef State,
-                                     const InvalidatedSymbols &Escaped,
-                                     const CallEvent *Call,
-                                     PointerEscapeKind Kind) const {
-    return State;
-  }
-
-  /// Called when const pointers escape.
-  ///
-  /// Note: in most cases checkPointerEscape callback is sufficient.
-  /// \sa checkPointerEscape
-  ProgramStateRef checkConstPointerEscape(ProgramStateRef State,
-                                     const InvalidatedSymbols &Escaped,
-                                     const CallEvent *Call,
-                                     PointerEscapeKind Kind) const {
-    return State;
-  }
-
-  /// check::Event<ImplicitNullDerefEvent>
-  void checkEvent(ImplicitNullDerefEvent Event) const {}
-
-  /// Check every declaration in the AST.
-  ///
-  /// An AST traversal callback, which should only be used when the checker is
-  /// not path sensitive. It will be called for every Declaration in the AST and
-  /// can be specialized to only be called on subclasses of Decl, for example,
-  /// FunctionDecl.
-  ///
-  /// check::ASTDecl<FunctionDecl>
-  void checkASTDecl(const FunctionDecl *D,
-                    AnalysisManager &Mgr,
-                    BugReporter &BR) const {}
-};
-
-void CheckerDocumentation::checkPostStmt(const DeclStmt *DS,
-                                         CheckerContext &C) const {
-}
-
-} // end namespace ento
-} // end namespace clang
Index: clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
+++ clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
@@ -347,10 +347,6 @@
   CFNumberChecker() : ICreate(nullptr), IGetValue(nullptr) {}
 
   void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;
-
-private:
-  void EmitError(const TypedRegion* R, const Expr *Ex,
-                uint64_t SourceSize, uint64_t TargetSize, uint64_t NumberKind);
 };
 } // end anonymous namespace
 
Index: clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
+++ clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
@@ -63,7 +63,6 @@
                                          SValBuilder &svalBuilder,
                                          SVal location);
 
-  void dump() const;
   void dumpToStream(raw_ostream &os) const;
 };
 }
@@ -262,9 +261,6 @@
 }
 
 #ifndef NDEBUG
-LLVM_DUMP_METHOD void RegionRawOffsetV2::dump() const {
-  dumpToStream(llvm::errs());
-}
 
 void RegionRawOffsetV2::dumpToStream(raw_ostream &os) const {
   os << "raw_offset_v2{" << getRegion() << ',' << getByteOffset() << '}';
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to