[libclang] Fix crash on invalid code. Fixes rdar://10451854

llvm-svn: 144766
This commit is contained in:
Argyrios Kyrtzidis 2011-11-16 02:35:10 +00:00
parent df15c20979
commit 516eec2d8b
3 changed files with 20 additions and 1 deletions

View File

@ -853,6 +853,9 @@ public:
}
void handleTopLevelDecl(Decl *D) {
if (!D)
return;
// 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

View File

@ -1487,7 +1487,8 @@ Parser::ParseObjCAtEndDeclaration(SourceRange atEnd) {
Actions.DefaultSynthesizeProperties(getCurScope(), ObjCImpDecl);
for (size_t i = 0; i < LateParsedObjCMethods.size(); ++i) {
Decl *D = ParseLexedObjCMethodDefs(*LateParsedObjCMethods[i]);
DeclsInGroup.push_back(D);
if (D)
DeclsInGroup.push_back(D);
}
DeclsInGroup.push_back(ObjCImpDecl);

View File

@ -0,0 +1,15 @@
struct {
@implementation Foo
- (void)finalize {
NSLog(@"bar");
}
- (NSArray *)graphics {
}
@end
// Test that we don't crash
// RUN: c-index-test -test-load-source-reparse 3 local %s