[cfe-commits] r141414 - in /cfe/trunk: include/clang/Analysis/ProgramPoint.h lib/Analysis/ProgramPoint.cpp lib/StaticAnalyzer/Core/CoreEngine.cpp

Anna Zaks ganna at apple.com
Fri Oct 7 14:01:38 PDT 2011


Author: zaks
Date: Fri Oct  7 16:01:38 2011
New Revision: 141414

URL: http://llvm.org/viewvc/llvm-project?rev=141414&view=rev
Log:
ProgramPoint cleanup after the previous commit r141408 (remove the copy constructor, mark withTag const).

Move getProgramPoint() utility from CoreEngine.cpp into ProgramPoint.

Modified:
    cfe/trunk/include/clang/Analysis/ProgramPoint.h
    cfe/trunk/lib/Analysis/ProgramPoint.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp

Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=141414&r1=141413&r2=141414&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
+++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Fri Oct  7 16:01:38 2011
@@ -78,12 +78,9 @@
   const void *getData2() const { return Data.second; }
 
 public:
-  ProgramPoint(const ProgramPoint &P)
-    : Data(P.Data), K(P.K), L(P.L), Tag(P.Tag) {}
-
   /// Create a new ProgramPoint object that is the same as the original
   /// except for using the specified tag value.
-  ProgramPoint withTag(const ProgramPointTag *tag) {
+  ProgramPoint withTag(const ProgramPointTag *tag) const {
     return ProgramPoint(Data.first, Data.second, K, L, tag);
   }
 
@@ -117,6 +114,11 @@
     ID.AddPointer(L);
     ID.AddPointer(Tag);
   }
+
+  static ProgramPoint getProgramPoint(const Stmt *S, ProgramPoint::Kind K,
+                                      const LocationContext *LC,
+                                      const ProgramPointTag *tag);
+
 };
 
 class BlockEntrance : public ProgramPoint {

Modified: cfe/trunk/lib/Analysis/ProgramPoint.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ProgramPoint.cpp?rev=141414&r1=141413&r2=141414&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ProgramPoint.cpp (original)
+++ cfe/trunk/lib/Analysis/ProgramPoint.cpp Fri Oct  7 16:01:38 2011
@@ -18,6 +18,31 @@
 
 ProgramPointTag::~ProgramPointTag() {}
 
+ProgramPoint ProgramPoint::getProgramPoint(const Stmt *S, ProgramPoint::Kind K,
+                                           const LocationContext *LC,
+                                           const ProgramPointTag *tag){
+  switch (K) {
+    default:
+      llvm_unreachable("Unhandled ProgramPoint kind");
+    case ProgramPoint::PreStmtKind:
+      return PreStmt(S, LC, tag);
+    case ProgramPoint::PostStmtKind:
+      return PostStmt(S, LC, tag);
+    case ProgramPoint::PreLoadKind:
+      return PreLoad(S, LC, tag);
+    case ProgramPoint::PostLoadKind:
+      return PostLoad(S, LC, tag);
+    case ProgramPoint::PreStoreKind:
+      return PreStore(S, LC, tag);
+    case ProgramPoint::PostStoreKind:
+      return PostStore(S, LC, tag);
+    case ProgramPoint::PostLValueKind:
+      return PostLValue(S, LC, tag);
+    case ProgramPoint::PostPurgeDeadSymbolsKind:
+      return PostPurgeDeadSymbols(S, LC, tag);
+  }
+}
+
 SimpleProgramPointTag::SimpleProgramPointTag(StringRef description)
   : desc(description) {}
 

Modified: cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp?rev=141414&r1=141413&r2=141414&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp Fri Oct  7 16:01:38 2011
@@ -541,31 +541,6 @@
   return N;
 }
 
-static ProgramPoint GetProgramPoint(const Stmt *S, ProgramPoint::Kind K,
-                                    const LocationContext *LC,
-                                    const ProgramPointTag *tag){
-  switch (K) {
-    default:
-      llvm_unreachable("Unhandled ProgramPoint kind");    
-    case ProgramPoint::PreStmtKind:
-      return PreStmt(S, LC, tag);
-    case ProgramPoint::PostStmtKind:
-      return PostStmt(S, LC, tag);
-    case ProgramPoint::PreLoadKind:
-      return PreLoad(S, LC, tag);
-    case ProgramPoint::PostLoadKind:
-      return PostLoad(S, LC, tag);
-    case ProgramPoint::PreStoreKind:
-      return PreStore(S, LC, tag);
-    case ProgramPoint::PostStoreKind:
-      return PostStore(S, LC, tag);
-    case ProgramPoint::PostLValueKind:
-      return PostLValue(S, LC, tag);
-    case ProgramPoint::PostPurgeDeadSymbolsKind:
-      return PostPurgeDeadSymbols(S, LC, tag);
-  }
-}
-
 ExplodedNode*
 StmtNodeBuilder::generateNodeInternal(const Stmt *S,
                                       const ProgramState *state,
@@ -573,8 +548,8 @@
                                       ProgramPoint::Kind K,
                                       const ProgramPointTag *tag) {
   
-  const ProgramPoint &L = GetProgramPoint(S, K, Pred->getLocationContext(),
-                                          tag);
+  const ProgramPoint &L = ProgramPoint::getProgramPoint(S, K,
+                                        Pred->getLocationContext(), tag);
   return generateNodeInternal(L, state, Pred);
 }
 





More information about the cfe-commits mailing list