summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-18 00:02:19 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-18 00:02:19 +0000
commite3dcb2ddd11d76b5b0a394f8c33437a38810bcb7 (patch)
tree775d32110ec52aac4047847f3a5fa36977e597da /clang/lib/AST/Decl.cpp
parent7d59a92b457ed8e9a6749e08ab06a0486494699c (diff)
downloadbcm5719-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/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index d733c8c929f..5d49d706d7e 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -320,7 +320,8 @@ void FunctionDecl::Destroy(ASTContext& C) {
}
-CompoundStmt *FunctionDecl::getBody(const FunctionDecl *&Definition) const {
+CompoundStmt *FunctionDecl::getBody(ASTContext &Context,
+ const FunctionDecl *&Definition) const {
for (const FunctionDecl *FD = this; FD != 0; FD = FD->PreviousDeclaration) {
if (FD->Body) {
Definition = FD;
@@ -331,6 +332,15 @@ CompoundStmt *FunctionDecl::getBody(const FunctionDecl *&Definition) const {
return 0;
}
+CompoundStmt *FunctionDecl::getBodyIfAvailable() const {
+ for (const FunctionDecl *FD = this; FD != 0; FD = FD->PreviousDeclaration) {
+ if (FD->Body)
+ return cast<CompoundStmt>(FD->Body);
+ }
+
+ return 0;
+}
+
bool FunctionDecl::isMain() const {
return getDeclContext()->getLookupContext()->isTranslationUnit() &&
getIdentifier() && getIdentifier()->isStr("main");
OpenPOWER on IntegriCloud