diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-18 00:02:19 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-18 00:02:19 +0000 |
commit | e3dcb2ddd11d76b5b0a394f8c33437a38810bcb7 (patch) | |
tree | 775d32110ec52aac4047847f3a5fa36977e597da /clang/lib/Analysis | |
parent | 7d59a92b457ed8e9a6749e08ab06a0486494699c (diff) | |
download | bcm5719-llvm-e3dcb2ddd11d76b5b0a394f8c33437a38810bcb7.tar.gz bcm5719-llvm-e3dcb2ddd11d76b5b0a394f8c33437a38810bcb7.zip |
FunctionDecl::getBody() is getting an ASTContext argument for use in
lazy PCH deserialization. Propagate that argument wherever it needs to
be. No functionality change, except that I've tightened up a few PCH
tests in preparation.
llvm-svn: 69406
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r-- | clang/lib/Analysis/BasicStore.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Analysis/BugReporter.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Analysis/CFRefCount.cpp | 3 | ||||
-rw-r--r-- | clang/lib/Analysis/CheckObjCDealloc.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Analysis/CheckObjCUnusedIVars.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Analysis/PathDiagnostic.cpp | 9 |
6 files changed, 16 insertions, 10 deletions
diff --git a/clang/lib/Analysis/BasicStore.cpp b/clang/lib/Analysis/BasicStore.cpp index 566c1971b7d..9047d9d8a95 100644 --- a/clang/lib/Analysis/BasicStore.cpp +++ b/clang/lib/Analysis/BasicStore.cpp @@ -525,7 +525,7 @@ Store BasicStoreManager::getInitialStore() { // Scan the method for ivar references. While this requires an // entire AST scan, the cost should not be high in practice. - St = scanForIvars(MD->getBody(), PD, St); + St = scanForIvars(MD->getBody(getContext()), PD, St); } } } diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp index 01f5e81bf58..7e7132aaab7 100644 --- a/clang/lib/Analysis/BugReporter.cpp +++ b/clang/lib/Analysis/BugReporter.cpp @@ -140,7 +140,7 @@ public: const ExplodedNode<GRState>* N); ParentMap& getParentMap() { - if (PM.get() == 0) PM.reset(new ParentMap(CodeDecl.getBody())); + if (PM.get() == 0) PM.reset(new ParentMap(CodeDecl.getBody(getContext()))); return *PM.get(); } @@ -163,7 +163,7 @@ public: BugReport& getReport() { return *R; } GRBugReporter& getBugReporter() { return BR; } GRStateManager& getStateManager() { return BR.getStateManager(); } - + PathDiagnosticLocation getEnclosingStmtLocation(const Stmt *S); PathDiagnosticLocation @@ -189,7 +189,7 @@ PathDiagnosticBuilder::ExecutionContinues(const ExplodedNode<GRState>* N) { if (Stmt *S = GetNextStmt(N)) return PathDiagnosticLocation(S, SMgr); - return FullSourceLoc(CodeDecl.getBody()->getRBracLoc(), SMgr); + return FullSourceLoc(CodeDecl.getBody(getContext())->getRBracLoc(), SMgr); } PathDiagnosticLocation diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp index cfeabd0cb1b..7443c521b3b 100644 --- a/clang/lib/Analysis/CFRefCount.cpp +++ b/clang/lib/Analysis/CFRefCount.cpp @@ -2903,7 +2903,8 @@ CFRefLeakReport::getEndPath(BugReporter& br, const ExplodedNode<GRState>* EndN){ } if (!L.isValid()) { - CompoundStmt *CS = BR.getStateManager().getCodeDecl().getBody(); + CompoundStmt *CS + = BR.getStateManager().getCodeDecl().getBody(BR.getContext()); L = PathDiagnosticLocation(CS->getRBracLoc(), SMgr); } diff --git a/clang/lib/Analysis/CheckObjCDealloc.cpp b/clang/lib/Analysis/CheckObjCDealloc.cpp index a14ae265128..0d6e7e46a0b 100644 --- a/clang/lib/Analysis/CheckObjCDealloc.cpp +++ b/clang/lib/Analysis/CheckObjCDealloc.cpp @@ -172,7 +172,7 @@ void clang::CheckObjCDealloc(ObjCImplementationDecl* D, } // dealloc found. Scan for missing [super dealloc]. - if (MD->getBody() && !scan_dealloc(MD->getBody(), S)) { + if (MD->getBody(Ctx) && !scan_dealloc(MD->getBody(Ctx), S)) { const char* name = LOpts.getGCMode() == LangOptions::NonGC ? "missing [super dealloc]" @@ -223,7 +223,7 @@ void clang::CheckObjCDealloc(ObjCImplementationDecl* D, // ivar must be released if and only if the kind of setter was not 'assign' bool requiresRelease = PD->getSetterKind() != ObjCPropertyDecl::Assign; - if(scan_ivar_release(MD->getBody(), ID, PD, RS, SelfII, Ctx) + if(scan_ivar_release(MD->getBody(Ctx), ID, PD, RS, SelfII, Ctx) != requiresRelease) { const char *name; const char* category = "Memory (Core Foundation/Objective-C)"; diff --git a/clang/lib/Analysis/CheckObjCUnusedIVars.cpp b/clang/lib/Analysis/CheckObjCUnusedIVars.cpp index 658a6b189aa..57fad8d86b6 100644 --- a/clang/lib/Analysis/CheckObjCUnusedIVars.cpp +++ b/clang/lib/Analysis/CheckObjCUnusedIVars.cpp @@ -85,7 +85,7 @@ void clang::CheckObjCUnusedIvar(ObjCImplementationDecl* D, BugReporter& BR) { // Now scan the methods for accesses. for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(), E = D->instmeth_end(); I!=E; ++I) - Scan(M, (*I)->getBody()); + Scan(M, (*I)->getBody(BR.getContext())); // Scan for @synthesized property methods that act as setters/getters // to an ivar. diff --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp index da007c16ec4..1d00727d0a2 100644 --- a/clang/lib/Analysis/PathDiagnostic.cpp +++ b/clang/lib/Analysis/PathDiagnostic.cpp @@ -171,8 +171,13 @@ SourceRange PathDiagnosticLocation::asRange() const { case DeclK: if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) return MD->getSourceRange(); - if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) - return FD->getBody()->getSourceRange(); + if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { + // FIXME: We would like to always get the function body, even + // when it needs to be de-serialized, but getting the + // ASTContext here requires significant changes. + if (CompoundStmt *Body = FD->getBodyIfAvailable()) + return Body->getSourceRange(); + } else { SourceLocation L = D->getLocation(); return SourceRange(L, L); |