summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-cc/ASTConsumers.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/tools/clang-cc/ASTConsumers.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/tools/clang-cc/ASTConsumers.cpp')
-rw-r--r--clang/tools/clang-cc/ASTConsumers.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/clang/tools/clang-cc/ASTConsumers.cpp b/clang/tools/clang-cc/ASTConsumers.cpp
index 61a9e4460ab..aabbf2ab4a3 100644
--- a/clang/tools/clang-cc/ASTConsumers.cpp
+++ b/clang/tools/clang-cc/ASTConsumers.cpp
@@ -80,9 +80,10 @@ void DeclPrinter:: PrintDecl(Decl *D) {
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
PrintFunctionDeclStart(FD);
- if (FD->getBody()) {
+ // FIXME: Pass a context here so we can use getBody()
+ if (FD->getBodyIfAvailable()) {
Out << ' ';
- FD->getBody()->printPretty(Out, 0, Indentation, true);
+ FD->getBodyIfAvailable()->printPretty(Out, 0, Indentation, true);
Out << '\n';
}
} else if (isa<ObjCMethodDecl>(D)) {
@@ -221,7 +222,8 @@ void DeclPrinter::Print(NamespaceDecl *NS) {
}
void DeclPrinter::PrintFunctionDeclStart(FunctionDecl *FD) {
- bool HasBody = FD->getBody();
+ // FIXME: pass a context so that we can use getBody.
+ bool HasBody = FD->getBodyIfAvailable();
Out << '\n';
@@ -264,7 +266,7 @@ void DeclPrinter::PrintFunctionDeclStart(FunctionDecl *FD) {
AFT->getResultType().getAsStringInternal(Proto);
Out << Proto;
- if (!FD->getBody())
+ if (!FD->getBodyIfAvailable())
Out << ";\n";
// Doesn't print the body.
}
@@ -596,10 +598,10 @@ void ASTDumper::HandleTopLevelSingleDecl(Decl *D) {
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
PrintFunctionDeclStart(FD);
- if (FD->getBody()) {
+ if (FD->getBodyIfAvailable()) {
Out << '\n';
// FIXME: convert dumper to use std::ostream?
- FD->getBody()->dumpAll(*SM);
+ FD->getBodyIfAvailable()->dumpAll(*SM);
Out << '\n';
}
} else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
@@ -664,9 +666,9 @@ void ASTViewer::HandleTopLevelSingleDecl(Decl *D) {
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
DeclPrinter().PrintFunctionDeclStart(FD);
- if (FD->getBody()) {
+ if (FD->getBodyIfAvailable()) {
llvm::cerr << '\n';
- FD->getBody()->viewAST();
+ FD->getBodyIfAvailable()->viewAST();
llvm::cerr << '\n';
}
return;
OpenPOWER on IntegriCloud