Get the Decl from the current ExplodedNode. Eventually the diagnostic client
and other core analysis logic will be untied to a particular Decl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79420 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Analysis/PathSensitive/AnalysisContext.h b/include/clang/Analysis/PathSensitive/AnalysisContext.h
index d945aeb..74e175e 100644
--- a/include/clang/Analysis/PathSensitive/AnalysisContext.h
+++ b/include/clang/Analysis/PathSensitive/AnalysisContext.h
@@ -79,6 +79,8 @@
LocationContext *getParent() const { return Parent; }
+ const Decl *getDecl() const { return getAnalysisContext()->getDecl(); }
+
CFG *getCFG() const { return getAnalysisContext()->getCFG(); }
LiveVariables *getLiveVariables() const {
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index 2e2665c..62313c6 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -189,7 +189,8 @@
if (const Stmt *S = GetNextStmt(N))
return PathDiagnosticLocation(S, getSourceManager());
- return FullSourceLoc(getCodeDecl().getBodyRBrace(), getSourceManager());
+ return FullSourceLoc(N->getLocationContext()->getDecl()->getBodyRBrace(),
+ getSourceManager());
}
PathDiagnosticLocation
@@ -208,7 +209,8 @@
<< '.';
else
os << "Execution jumps to the end of the "
- << (isa<ObjCMethodDecl>(getCodeDecl()) ? "method" : "function") << '.';
+ << (isa<ObjCMethodDecl>(N->getLocationContext()->getDecl()) ?
+ "method" : "function") << '.';
return Loc;
}