[cfe-commits] r89884 - in /cfe/trunk: include/clang/Analysis/PathSensitive/GRExprEngine.h lib/Analysis/GRExprEngine.cpp lib/Frontend/AnalysisConsumer.cpp

Ted Kremenek kremenek at apple.com
Wed Nov 25 13:51:20 PST 2009


Author: kremenek
Date: Wed Nov 25 15:51:20 2009
New Revision: 89884

URL: http://llvm.org/viewvc/llvm-project?rev=89884&view=rev
Log:
Make RegisterInternalChecks() part of GRExprEngine's private implementation by making it a static function within GRExprEngine.cpp.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
    cfe/trunk/lib/Analysis/GRExprEngine.cpp
    cfe/trunk/lib/Frontend/AnalysisConsumer.cpp

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h?rev=89884&r1=89883&r2=89884&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h Wed Nov 25 15:51:20 2009
@@ -129,8 +129,6 @@
   ExplodedGraph& getGraph() { return G; }
   const ExplodedGraph& getGraph() const { return G; }
 
-  void RegisterInternalChecks();
-
   template <typename CHECKER>
   void registerCheck(CHECKER *check) {
     unsigned entry = Checkers.size();

Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=89884&r1=89883&r2=89884&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Wed Nov 25 15:51:20 2009
@@ -38,6 +38,15 @@
 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 @@
 // 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 @@
     BR(mgr, *this)
 {
   // Register internal checks.
-  RegisterInternalChecks();
+  RegisterInternalChecks(*this);
 }
 
 GRExprEngine::~GRExprEngine() {
@@ -233,7 +260,6 @@
 // Utility methods.
 //===----------------------------------------------------------------------===//
 
-
 void GRExprEngine::setTransferFunctions(GRTransferFuncs* tf) {
   StateMgr.TF = tf;
   tf->RegisterChecks(*this);
@@ -3013,27 +3039,3 @@
   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);
-}

Modified: cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/AnalysisConsumer.cpp?rev=89884&r1=89883&r2=89884&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/AnalysisConsumer.cpp Wed Nov 25 15:51:20 2009
@@ -464,7 +464,6 @@
 
   Eng.setTransferFunctions(TF.get());
   
-  Eng.RegisterInternalChecks();
   RegisterAppleChecks(Eng, *D);
 
   // Execute the worklist algorithm.





More information about the cfe-commits mailing list