]> granicus.if.org Git - clang/commitdiff
[analyzer] Remove LocationContext and a dependency from PathDiagnosticLoaction.
authorAnna Zaks <ganna@apple.com>
Tue, 20 Sep 2011 16:23:37 +0000 (16:23 +0000)
committerAnna Zaks <ganna@apple.com>
Tue, 20 Sep 2011 16:23:37 +0000 (16:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140146 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
lib/StaticAnalyzer/Core/BugReporter.cpp
lib/StaticAnalyzer/Core/PathDiagnostic.cpp

index 0e6b75278b5773945601890f70580ff7926c7d51..55179779b4d7a4134e21db051fb7fd6a57a05251 100644 (file)
@@ -95,7 +95,6 @@ private:
   const Stmt *S;
   const Decl *D;
   const SourceManager *SM;
-  const LocationContext *LC;
   FullSourceLoc Loc;
   PathDiagnosticRange Range;
 
@@ -104,17 +103,17 @@ private:
 
 public:
   PathDiagnosticLocation()
-    : K(SingleLocK), S(0), D(0), SM(0), LC(0) {
+    : K(SingleLocK), S(0), D(0), SM(0) {
   }
 
   PathDiagnosticLocation(FullSourceLoc L)
-    : K(SingleLocK), R(L, L), S(0), D(0), SM(&L.getManager()), LC(0),
+    : K(SingleLocK), R(L, L), S(0), D(0), SM(&L.getManager()),
       Loc(genLocation()), Range(genRange()) {
   }
 
   PathDiagnosticLocation(SourceLocation L, const SourceManager &sm,
                          Kind kind = SingleLocK)
-    : K(kind), R(L, L), S(0), D(0), SM(&sm), LC(0),
+    : K(kind), R(L, L), S(0), D(0), SM(&sm),
       Loc(genLocation()), Range(genRange()) {
   }
 
@@ -123,7 +122,7 @@ public:
                          const LocationContext *lc);
 
   PathDiagnosticLocation(const Decl *d, const SourceManager &sm)
-    : K(DeclK), S(0), D(d), SM(&sm), LC(0),
+    : K(DeclK), S(0), D(d), SM(&sm),
       Loc(genLocation()), Range(genRange()) {
   }
 
@@ -171,7 +170,7 @@ public:
                                              const PathDiagnosticLocation &PDL);
 
   bool operator==(const PathDiagnosticLocation &X) const {
-    return K == X.K && R == X.R && S == X.S && D == X.D && LC == X.LC;
+    return K == X.K && R == X.R && S == X.S && D == X.D;
   }
 
   bool operator!=(const PathDiagnosticLocation &X) const {
@@ -202,7 +201,6 @@ public:
   void flatten();
 
   const SourceManager& getManager() const { assert(isValid()); return *SM; }
-  const LocationContext* getLocationContext() const { return LC; }
   
   void Profile(llvm::FoldingSetNodeID &ID) const;
 };
index 043f5d2b813397d5c72634a5d577d1b0801f2a41..7a0a5430aab8a1857d45fa897ce5e8b10e36bd02 100644 (file)
@@ -877,7 +877,7 @@ class EdgeBuilder {
       }
 
       if (S != Original)
-        L = PathDiagnosticLocation(S, L.getManager(), L.getLocationContext());
+        L = PathDiagnosticLocation(S, L.getManager(), PDB.getLocationContext());
     }
 
     if (firstCharOnly)
index 40b73deacb94b0ab6f052f7e476232d3d91f40cf..6ef2b075b335c8d0f1fd90e89fa5d50d17745b8c 100644 (file)
@@ -147,7 +147,7 @@ static SourceLocation getValidSourceLocation(const Stmt* S,
 PathDiagnosticLocation::PathDiagnosticLocation(const Stmt *s,
                                                const SourceManager &sm,
                                                const LocationContext *lc)
-  : K(StmtK), S(s), D(0), SM(&sm), LC(lc)
+  : K(StmtK), S(s), D(0), SM(&sm)
 {
   const ParentMap* PM = 0;
   if (lc)
@@ -264,7 +264,7 @@ FullSourceLoc
     case RangeK:
       break;
     case StmtK:
-      return FullSourceLoc(getValidSourceLocation(S, LC->getParentMap()),
+      return FullSourceLoc(getValidSourceLocation(S, *PM),
                            const_cast<SourceManager&>(*SM));
     case DeclK:
       return FullSourceLoc(D->getLocation(), const_cast<SourceManager&>(*SM));
@@ -309,7 +309,7 @@ PathDiagnosticRange
         case Stmt::BinaryConditionalOperatorClass:
         case Stmt::ConditionalOperatorClass:
         case Stmt::ObjCForCollectionStmtClass: {
-          SourceLocation L = getValidSourceLocation(S, LC->getParentMap());
+          SourceLocation L = getValidSourceLocation(S, *PM);
           return SourceRange(L, L);
         }
       }