[cfe-commits] r140200 - /cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h

Anna Zaks ganna at apple.com
Tue Sep 20 15:43:32 PDT 2011


Author: zaks
Date: Tue Sep 20 17:43:32 2011
New Revision: 140200

URL: http://llvm.org/viewvc/llvm-project?rev=140200&view=rev
Log:
[analyzer] Refactor PathDiagnosticLocation: Add comments. Remove the last constructor which could allow invalid locations to slip in.

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

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=140200&r1=140199&r2=140200&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Tue Sep 20 17:43:32 2011
@@ -107,22 +107,19 @@
     : K(kind), R(L, L), S(0), D(0), SM(&sm),
       Loc(genLocation()), Range(genRange()) {
   }
-  
+
   FullSourceLoc
     genLocation(LocationOrAnalysisContext LAC = (AnalysisContext*)0) const;
   PathDiagnosticRange
     genRange(LocationOrAnalysisContext LAC = (AnalysisContext*)0) const;
 
 public:
+  /// Create an invalid location.
   PathDiagnosticLocation()
     : K(SingleLocK), S(0), D(0), SM(0) {
   }
 
-  PathDiagnosticLocation(FullSourceLoc L)
-    : K(SingleLocK), R(L, L), S(0), D(0), SM(&L.getManager()),
-      Loc(genLocation()), Range(genRange()) {
-  }
-
+  /// Create a location corresponding to the given statement.
   PathDiagnosticLocation(const Stmt *s,
                          const SourceManager &sm,
                          LocationOrAnalysisContext lac)
@@ -130,11 +127,13 @@
       Loc(genLocation(lac)), Range(genRange(lac)) {}
 
 
+  /// Create a location corresponding to the given declaration.
   PathDiagnosticLocation(const Decl *d, const SourceManager &sm)
     : K(DeclK), S(0), D(d), SM(&sm),
       Loc(genLocation()), Range(genRange()) {
   }
 
+  /// Create a location corresponding to the given declaration.
   static PathDiagnosticLocation create(const Decl *D,
                                        const SourceManager &SM) {
     return PathDiagnosticLocation(D, SM);





More information about the cfe-commits mailing list