diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-05 21:28:06 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-05 21:28:06 +0000 |
commit | 0d94094cdbfd531ec96b719e0c8339aff7463ff9 (patch) | |
tree | 2b8b71bb5ad25849cc0c90224ff125c30e2ea79a | |
parent | 88934e85f81abdc4fb5202325252be3bcab5ebf0 (diff) |
Fix crash when using archaic protocol, rdar://10238337
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141215 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/SelectorLocationsKind.cpp | 5 | ||||
-rw-r--r-- | test/SemaObjC/protocol-archane.m | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/AST/SelectorLocationsKind.cpp b/lib/AST/SelectorLocationsKind.cpp index 9a44b387dd..671207a7f2 100644 --- a/lib/AST/SelectorLocationsKind.cpp +++ b/lib/AST/SelectorLocationsKind.cpp @@ -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> diff --git a/test/SemaObjC/protocol-archane.m b/test/SemaObjC/protocol-archane.m index 138c43d1a8..992d3e4798 100644 --- a/test/SemaObjC/protocol-archane.m +++ b/test/SemaObjC/protocol-archane.m @@ -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 |