diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-13 21:35:00 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-13 21:35:00 +0000 |
commit | 144b38a7995cbe0928e34fbcc865bb2d2be4f7a3 (patch) | |
tree | 981d722a5c76ddff74a3a1903f3cba0168acc976 /lib/Serialization/ASTReaderDecl.cpp | |
parent | 93013b235680b184be3cda150bcd6456944415f4 (diff) |
[PCH] Fix a regression that r139441 introduced (decls were getting passed
to the consumer without being fully deserialized).
The regression was on compiling boost.python and it was too difficult to get a reduced
test case unfortunately.
Also modify the logic of how objc methods are getting passed to the consumer;
codegen depended on receiving objc methods before the implementation decl.
Since the interesting objc methods are ones with a body and such methods only
exist inside an ObjCImplDecl, deserialize and pass to consumer all the methods
of ObCImplDecl when we see one.
Fixes http://llvm.org/PR10922 & rdar://10117105.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139644 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | lib/Serialization/ASTReaderDecl.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index b794938d36..444888911c 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -1393,6 +1393,9 @@ inline void ASTReader::LoadedDecl(unsigned Index, Decl *D) { /// code generation, e.g., inline function definitions, Objective-C /// declarations with metadata, etc. static bool isConsumerInterestedIn(Decl *D) { + // An ObjCMethodDecl is never considered as "interesting" because its + // implementation container always is. + if (isa<FileScopeAsmDecl>(D) || isa<ObjCProtocolDecl>(D) || isa<ObjCImplDecl>(D)) @@ -1402,8 +1405,6 @@ static bool isConsumerInterestedIn(Decl *D) { Var->isThisDeclarationADefinition() == VarDecl::Definition; if (FunctionDecl *Func = dyn_cast<FunctionDecl>(D)) return Func->doesThisDeclarationHaveABody(); - if (ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(D)) - return Method->hasBody(); return false; } @@ -1737,14 +1738,8 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) { // AST consumer might need to know about, queue it. // We don't pass it to the consumer immediately because we may be in recursive // loading, and some declarations may still be initializing. - if (isConsumerInterestedIn(D)) { - if (Consumer) { - DeclGroupRef DG(D); - Consumer->HandleInterestingDecl(DG); - } else { + if (isConsumerInterestedIn(D)) InterestingDecls.push_back(D); - } - } return D; } |