[cfe-commits] r140146 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h lib/StaticAnalyzer/Core/BugReporter.cpp lib/StaticAnalyzer/Core/PathDiagnostic.cpp

Anna Zaks ganna at apple.com
Tue Sep 20 09:23:37 PDT 2011


Author: zaks
Date: Tue Sep 20 11:23:37 2011
New Revision: 140146

URL: http://llvm.org/viewvc/llvm-project?rev=140146&view=rev
Log:
[analyzer] Remove LocationContext and a dependency from PathDiagnosticLoaction.

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
    cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=140146&r1=140145&r2=140146&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Tue Sep 20 11:23:37 2011
@@ -95,7 +95,6 @@
   const Stmt *S;
   const Decl *D;
   const SourceManager *SM;
-  const LocationContext *LC;
   FullSourceLoc Loc;
   PathDiagnosticRange Range;
 
@@ -104,17 +103,17 @@
 
 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 @@
                          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 @@
                                              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 @@
   void flatten();
 
   const SourceManager& getManager() const { assert(isValid()); return *SM; }
-  const LocationContext* getLocationContext() const { return LC; }
   
   void Profile(llvm::FoldingSetNodeID &ID) const;
 };

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=140146&r1=140145&r2=140146&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Tue Sep 20 11:23:37 2011
@@ -877,7 +877,7 @@
       }
 
       if (S != Original)
-        L = PathDiagnosticLocation(S, L.getManager(), L.getLocationContext());
+        L = PathDiagnosticLocation(S, L.getManager(), PDB.getLocationContext());
     }
 
     if (firstCharOnly)

Modified: cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=140146&r1=140145&r2=140146&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Tue Sep 20 11:23:37 2011
@@ -147,7 +147,7 @@
 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 @@
     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 @@
         case Stmt::BinaryConditionalOperatorClass:
         case Stmt::ConditionalOperatorClass:
         case Stmt::ObjCForCollectionStmtClass: {
-          SourceLocation L = getValidSourceLocation(S, LC->getParentMap());
+          SourceLocation L = getValidSourceLocation(S, *PM);
           return SourceRange(L, L);
         }
       }





More information about the cfe-commits mailing list