diff options
author | Anna Zaks <ganna@apple.com> | 2011-09-20 21:38:35 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-09-20 21:38:35 +0000 |
commit | c29bed398971e550a4cacddf3dcf2b6b8a6e37b4 (patch) | |
tree | 24005460986f13145de014f4313f7c6be77477c0 /clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp | |
parent | 61a003315e74d7e072e6702b0384921696d9f767 (diff) | |
download | bcm5719-llvm-c29bed398971e550a4cacddf3dcf2b6b8a6e37b4.tar.gz bcm5719-llvm-c29bed398971e550a4cacddf3dcf2b6b8a6e37b4.zip |
[analyzer] Refactor PathDiagnosticLocation: Make PathDiagnosticLocation(SourceLocation...) private. Most of the effort here goes to making BugReport refer to a PathDiagnosticLocation instead of FullSourceLocation.
(Another step closer to the goal of having Diagnostics which can recover from invalid SourceLocations.)
llvm-svn: 140182
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp index cb6c1c62801..de9c021398f 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp @@ -166,6 +166,9 @@ static void checkObjCDealloc(const ObjCImplementationDecl *D, } } + PathDiagnosticLocation DLoc = + PathDiagnosticLocation::createBegin(D, BR.getSourceManager()); + if (!MD) { // No dealloc found. const char* name = LOpts.getGC() == LangOptions::NonGC @@ -176,7 +179,7 @@ static void checkObjCDealloc(const ObjCImplementationDecl *D, llvm::raw_string_ostream os(buf); os << "Objective-C class '" << D << "' lacks a 'dealloc' instance method"; - BR.EmitBasicReport(name, os.str(), D->getLocStart()); + BR.EmitBasicReport(name, os.str(), DLoc); return; } @@ -193,7 +196,7 @@ static void checkObjCDealloc(const ObjCImplementationDecl *D, << "' does not send a 'dealloc' message to its super class" " (missing [super dealloc])"; - BR.EmitBasicReport(name, os.str(), D->getLocStart()); + BR.EmitBasicReport(name, os.str(), DLoc); return; } @@ -257,7 +260,10 @@ static void checkObjCDealloc(const ObjCImplementationDecl *D, "but was released in 'dealloc'"; } - BR.EmitBasicReport(name, category, os.str(), (*I)->getLocation()); + PathDiagnosticLocation SDLoc = + PathDiagnosticLocation::createBegin((*I), BR.getSourceManager()); + + BR.EmitBasicReport(name, category, os.str(), SDLoc); } } } |