diff options
| author | Ted Kremenek <kremenek@apple.com> | 2009-11-25 21:51:20 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2009-11-25 21:51:20 +0000 |
| commit | d0fe8047ddf01ec7458b1f54c06b81a8ce265f65 (patch) | |
| tree | 215f5f79b9baa443953090151cd00f3515fbe7d7 | |
| parent | efb5003f9578b770f42d9eb0b1048b1ad8d00e8f (diff) | |
| download | bcm5719-llvm-d0fe8047ddf01ec7458b1f54c06b81a8ce265f65.tar.gz bcm5719-llvm-d0fe8047ddf01ec7458b1f54c06b81a8ce265f65.zip | |
Make RegisterInternalChecks() part of GRExprEngine's private implementation by making it a static function within GRExprEngine.cpp.
llvm-svn: 89884
| -rw-r--r-- | clang/include/clang/Analysis/PathSensitive/GRExprEngine.h | 2 | ||||
| -rw-r--r-- | clang/lib/Analysis/GRExprEngine.cpp | 62 | ||||
| -rw-r--r-- | clang/lib/Frontend/AnalysisConsumer.cpp | 1 |
3 files changed, 32 insertions, 33 deletions
diff --git a/clang/include/clang/Analysis/PathSensitive/GRExprEngine.h b/clang/include/clang/Analysis/PathSensitive/GRExprEngine.h index 89a21d7875e..a7302c0602e 100644 --- a/clang/include/clang/Analysis/PathSensitive/GRExprEngine.h +++ b/clang/include/clang/Analysis/PathSensitive/GRExprEngine.h @@ -129,8 +129,6 @@ public: ExplodedGraph& getGraph() { return G; } const ExplodedGraph& getGraph() const { return G; } - void RegisterInternalChecks(); - template <typename CHECKER> void registerCheck(CHECKER *check) { unsigned entry = Checkers.size(); diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp index bfdbbdbad29..a0040f4e874 100644 --- a/clang/lib/Analysis/GRExprEngine.cpp +++ b/clang/lib/Analysis/GRExprEngine.cpp @@ -38,6 +38,15 @@ using llvm::cast; using llvm::APSInt; //===----------------------------------------------------------------------===// +// Utility functions. +//===----------------------------------------------------------------------===// + +static inline Selector GetNullarySelector(const char* name, ASTContext& Ctx) { + IdentifierInfo* II = &Ctx.Idents.get(name); + return Ctx.Selectors.getSelector(0, &II); +} + +//===----------------------------------------------------------------------===// // Batch auditor. DEPRECATED. //===----------------------------------------------------------------------===// @@ -197,12 +206,30 @@ void GRExprEngine::CheckerVisitBind(const Stmt *AssignE, const Stmt *StoreE, // Engine construction and deletion. //===----------------------------------------------------------------------===// -static inline Selector GetNullarySelector(const char* name, ASTContext& Ctx) { - IdentifierInfo* II = &Ctx.Idents.get(name); - return Ctx.Selectors.getSelector(0, &II); +static void RegisterInternalChecks(GRExprEngine &Eng) { + // Register internal "built-in" BugTypes with the BugReporter. These BugTypes + // are different than what probably many checks will do since they don't + // create BugReports on-the-fly but instead wait until GRExprEngine finishes + // analyzing a function. Generation of BugReport objects is done via a call + // to 'FlushReports' from BugReporter. + // The following checks do not need to have their associated BugTypes + // explicitly registered with the BugReporter. If they issue any BugReports, + // their associated BugType will get registered with the BugReporter + // automatically. Note that the check itself is owned by the GRExprEngine + // object. + RegisterAttrNonNullChecker(Eng); + RegisterCallAndMessageChecker(Eng); + RegisterDereferenceChecker(Eng); + RegisterVLASizeChecker(Eng); + RegisterDivZeroChecker(Eng); + RegisterReturnStackAddressChecker(Eng); + RegisterReturnUndefChecker(Eng); + RegisterUndefinedArraySubscriptChecker(Eng); + RegisterUndefinedAssignmentChecker(Eng); + RegisterUndefBranchChecker(Eng); + RegisterUndefResultChecker(Eng); } - GRExprEngine::GRExprEngine(AnalysisManager &mgr) : AMgr(mgr), CoreEngine(mgr.getASTContext(), *this), @@ -219,7 +246,7 @@ GRExprEngine::GRExprEngine(AnalysisManager &mgr) BR(mgr, *this) { // Register internal checks. - RegisterInternalChecks(); + RegisterInternalChecks(*this); } GRExprEngine::~GRExprEngine() { @@ -233,7 +260,6 @@ GRExprEngine::~GRExprEngine() { // Utility methods. //===----------------------------------------------------------------------===// - void GRExprEngine::setTransferFunctions(GRTransferFuncs* tf) { StateMgr.TF = tf; tf->RegisterChecks(*this); @@ -3013,27 +3039,3 @@ void GRExprEngine::ViewGraph(ExplodedNode** Beg, ExplodedNode** End) { GraphPrintSourceManager = NULL; #endif } - -void GRExprEngine::RegisterInternalChecks() { - // Register internal "built-in" BugTypes with the BugReporter. These BugTypes - // are different than what probably many checks will do since they don't - // create BugReports on-the-fly but instead wait until GRExprEngine finishes - // analyzing a function. Generation of BugReport objects is done via a call - // to 'FlushReports' from BugReporter. - // The following checks do not need to have their associated BugTypes - // explicitly registered with the BugReporter. If they issue any BugReports, - // their associated BugType will get registered with the BugReporter - // automatically. Note that the check itself is owned by the GRExprEngine - // object. - RegisterAttrNonNullChecker(*this); - RegisterCallAndMessageChecker(*this); - RegisterDereferenceChecker(*this); - RegisterVLASizeChecker(*this); - RegisterDivZeroChecker(*this); - RegisterReturnStackAddressChecker(*this); - RegisterReturnUndefChecker(*this); - RegisterUndefinedArraySubscriptChecker(*this); - RegisterUndefinedAssignmentChecker(*this); - RegisterUndefBranchChecker(*this); - RegisterUndefResultChecker(*this); -} diff --git a/clang/lib/Frontend/AnalysisConsumer.cpp b/clang/lib/Frontend/AnalysisConsumer.cpp index 43e168fbd7c..ad980feaa37 100644 --- a/clang/lib/Frontend/AnalysisConsumer.cpp +++ b/clang/lib/Frontend/AnalysisConsumer.cpp @@ -464,7 +464,6 @@ static void ActionInlineCall(AnalysisConsumer &C, AnalysisManager &mgr, Eng.setTransferFunctions(TF.get()); - Eng.RegisterInternalChecks(); RegisterAppleChecks(Eng, *D); // Execute the worklist algorithm. |

