]> granicus.if.org Git - clang/commitdiff
Get the Decl from the current ExplodedNode. Eventually the diagnostic client
authorZhongxing Xu <xuzhongxing@gmail.com>
Wed, 19 Aug 2009 12:50:00 +0000 (12:50 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Wed, 19 Aug 2009 12:50:00 +0000 (12:50 +0000)
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

include/clang/Analysis/PathSensitive/AnalysisContext.h
lib/Analysis/BugReporter.cpp

index d945aebb995f652d74c3815823c5fd678b249193..74e175ef73287d3891aba87226f3d70b8339dc7e 100644 (file)
@@ -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 { 
index 2e2665c1738af8409074037e1889f73e03de550a..62313c67b65aa176bc9564d465f5a055018f6db9 100644 (file)
@@ -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<ObjCMethodDecl>(getCodeDecl()) ? "method" : "function") << '.';
+       << (isa<ObjCMethodDecl>(N->getLocationContext()->getDecl()) ?
+             "method" : "function") << '.';
   
   return Loc;
 }