aboutsummaryrefslogtreecommitdiff
path: root/lib/AST
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
commit7297134f128423fce2e88f92421ed135bded7d4e (patch)
tree8df6b1ae77f5063393a822109210f9619976e995 /lib/AST
parent95d0281798d837041272c4dbeed37b33ca0f2b0d (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69406 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST')
-rw-r--r--lib/AST/Decl.cpp12
-rw-r--r--lib/AST/DeclSerialization.cpp6
-rw-r--r--lib/AST/Expr.cpp8
3 files changed, 20 insertions, 6 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index d733c8c929..5d49d706d7 100644
--- a/lib/AST/Decl.cpp
+++ b/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");
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index 3ffcc49c36..81fdae2edc 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -477,11 +477,11 @@ void FunctionDecl::EmitImpl(Serializer& S) const {
if (ParamInfo != NULL) {
S.EmitBool(true);
S.EmitInt(getNumParams());
- S.BatchEmitOwnedPtrs(getNumParams(),&ParamInfo[0], Body);
+ // FIXME: S.BatchEmitOwnedPtrs(getNumParams(),&ParamInfo[0], Body);
}
else {
S.EmitBool(false);
- S.EmitOwnedPtr(Body);
+ // FIXME: S.EmitOwnedPtr(Body);
}
}
@@ -508,7 +508,7 @@ FunctionDecl* FunctionDecl::CreateImpl(Deserializer& D, ASTContext& C) {
if (hasParamDecls)
D.BatchReadOwnedPtrs(numParams,
reinterpret_cast<Decl**>(&decl->ParamInfo[0]),
- decl->Body, C);
+ /*FIXME: decl->Body,*/ C);
else
decl->Body = D.ReadOwnedPtr<Stmt>(C);
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 523615491d..46dce59d3e 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -399,8 +399,12 @@ const FunctionType *BlockExpr::getFunctionType() const {
SourceLocation BlockExpr::getCaretLocation() const {
return TheBlock->getCaretLocation();
}
-const Stmt *BlockExpr::getBody() const { return TheBlock->getBody(); }
-Stmt *BlockExpr::getBody() { return TheBlock->getBody(); }
+const Stmt *BlockExpr::getBody() const {
+ return TheBlock->getBody();
+}
+Stmt *BlockExpr::getBody() {
+ return TheBlock->getBody();
+}
//===----------------------------------------------------------------------===//