forked from OSchip/llvm-project
[libclang] Fix crash on invalid code. Fixes rdar://10451854
llvm-svn: 144766
This commit is contained in:
parent
df15c20979
commit
516eec2d8b
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue