Fix crash when using archaic protocol, rdar://10238337

llvm-svn: 141215
This commit is contained in:
Argyrios Kyrtzidis 2011-10-05 21:28:06 +00:00
parent 3abead76ea
commit a7324ede34
2 changed files with 11 additions and 1 deletions

View File

@ -54,8 +54,11 @@ SourceLocation getArgLoc<Expr>(Expr *Arg) {
template <>
SourceLocation getArgLoc<ParmVarDecl>(ParmVarDecl *Arg) {
SourceLocation Loc = Arg->getLocStart();
if (Loc.isInvalid())
return Loc;
// -1 to point to left paren of the method parameter's type.
return Arg->getLocStart().getLocWithOffset(-1);
return Loc.getLocWithOffset(-1);
}
template <typename T>

View File

@ -33,3 +33,10 @@ typedef struct objc_class *Class;
Class <SomeProtocol> UnfortunateGCCExtension;
// rdar://10238337
@protocol Broken @end
@interface Crash @end
@implementation Crash
- (void)crashWith:(<Broken>)a { // expected-warning {{protocol qualifiers without 'id' is archaic}}
}
@end