[cfe-commits] r79420 - in /cfe/trunk: include/clang/Analysis/PathSensitive/AnalysisContext.h lib/Analysis/BugReporter.cpp

Zhongxing Xu xuzhongxing at gmail.com
Wed Aug 19 05:50:01 PDT 2009


Author: zhongxingxu
Date: Wed Aug 19 07:50:00 2009
New Revision: 79420

URL: http://llvm.org/viewvc/llvm-project?rev=79420&view=rev
Log:
Get the Decl from the current ExplodedNode. Eventually the diagnostic client
and other core analysis logic will be untied to a particular Decl.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h
    cfe/trunk/lib/Analysis/BugReporter.cpp

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h?rev=79420&r1=79419&r2=79420&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h Wed Aug 19 07:50:00 2009
@@ -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 { 

Modified: cfe/trunk/lib/Analysis/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BugReporter.cpp?rev=79420&r1=79419&r2=79420&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Wed Aug 19 07:50:00 2009
@@ -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;
 }





More information about the cfe-commits mailing list