diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
commit | 0883ccd9eac3b974df00e6548ee319a7dd3646f4 (patch) | |
tree | d6a70c3518b8dea8be7062438d7e8676820ed17f /lib/Frontend/ASTUnit.cpp | |
parent | 60bfabcd8ce617297c0d231f77d14ab507e98796 (diff) |
Notes
Diffstat (limited to 'lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 427bd6a9b8035..4730bdc2f1619 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); + } } }; @@ -431,8 +439,10 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, const driver::ArgStringList &CCArgs = Cmd->getArguments(); llvm::OwningPtr<CompilerInvocation> CI(new CompilerInvocation); - CompilerInvocation::CreateFromArgs(*CI, (const char**) CCArgs.data(), - (const char**) CCArgs.data()+CCArgs.size(), + CompilerInvocation::CreateFromArgs(*CI, + const_cast<const char **>(CCArgs.data()), + const_cast<const char **>(CCArgs.data()) + + CCArgs.size(), *Diags); // Override any files that need remapping |