diff options
author | Anna Zaks <ganna@apple.com> | 2011-09-20 22:43:32 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-09-20 22:43:32 +0000 |
commit | 6422e95c6673b647c65e99ef8a8707092e9116e4 (patch) | |
tree | d5c797bd781e75834d3231546c5ab225ffbabc39 | |
parent | f7638e1e51e437cd7f889731fe0cce0abd131ea0 (diff) | |
download | bcm5719-llvm-6422e95c6673b647c65e99ef8a8707092e9116e4.tar.gz bcm5719-llvm-6422e95c6673b647c65e99ef8a8707092e9116e4.zip |
[analyzer] Refactor PathDiagnosticLocation: Add comments. Remove the last constructor which could allow invalid locations to slip in.
llvm-svn: 140200
-rw-r--r-- | clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h index 53703f66623..e7baae6293d 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -107,22 +107,19 @@ private: : 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 @@ public: 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); |