aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/ASTUnit.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-05-03 20:16:35 +0000
committerTed Kremenek <kremenek@apple.com>2010-05-03 20:16:35 +0000
commitda5a428bf3db404fe3c91b689cd87c68789d6db9 (patch)
tree49a3f7043c08cb8568d6cf137210c4ef7bb7d518 /lib/Frontend/ASTUnit.cpp
parente174bd05ca9991e705f51afcfab27933b537dc63 (diff)
Workaround: Don't add ObjCMethodDecls to the vector of TopLevelDecls since they don't go in
the DeclContext for the translation unit. This is to workaround a fundamental issue in how ObjC decls (within an @implementation) are parsed before the ObjCContainerDecl is available. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102944 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTUnit.cpp')
-rw-r--r--lib/Frontend/ASTUnit.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index 0f7dca2d6b..4730bdc2f1 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -265,8 +265,16 @@ public:
TopLevelDeclTrackerConsumer(ASTUnit &_Unit) : Unit(_Unit) {}
void HandleTopLevelDecl(DeclGroupRef D) {
- for (DeclGroupRef::iterator it = D.begin(), ie = D.end(); it != ie; ++it)
- Unit.getTopLevelDecls().push_back(*it);
+ for (DeclGroupRef::iterator it = D.begin(), ie = D.end(); it != ie; ++it) {
+ Decl *D = *it;
+ // FIXME: Currently ObjC method declarations are incorrectly being
+ // reported as top-level declarations, even though their DeclContext
+ // is the containing ObjC @interface/@implementation. This is a
+ // fundamental problem in the parser right now.
+ if (isa<ObjCMethodDecl>(D))
+ continue;
+ Unit.getTopLevelDecls().push_back(D);
+ }
}
};