From: Zhongxing Xu Date: Wed, 19 Aug 2009 12:50:00 +0000 (+0000) Subject: Get the Decl from the current ExplodedNode. Eventually the diagnostic client X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7a50a4ee255b3a624ae64125537a7bdbd1da0ef;p=clang 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 d945aebb99..74e175ef73 100644 --- a/include/clang/Analysis/PathSensitive/AnalysisContext.h +++ b/include/clang/Analysis/PathSensitive/AnalysisContext.h @@ -79,6 +79,8 @@ public: 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 2e2665c173..62313c67b6 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/lib/Analysis/BugReporter.cpp @@ -189,7 +189,8 @@ PathDiagnosticBuilder::ExecutionContinues(const ExplodedNode* N) { 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 @@ PathDiagnosticBuilder::ExecutionContinues(llvm::raw_string_ostream& os, << '.'; else os << "Execution jumps to the end of the " - << (isa(getCodeDecl()) ? "method" : "function") << '.'; + << (isa(N->getLocationContext()->getDecl()) ? + "method" : "function") << '.'; return Loc; }