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 | a7324ede34e7449c51a95e00dc58f2332457b2ed (patch) | |
tree | 0716705d78d7d3fef87723b1fb74bc7e12f99c10 | |
parent | 3abead76eab9c931c3b8374cbe137ad5dbf85516 (diff) | |
download | bcm5719-llvm-a7324ede34e7449c51a95e00dc58f2332457b2ed.tar.gz bcm5719-llvm-a7324ede34e7449c51a95e00dc58f2332457b2ed.zip |
Fix crash when using archaic protocol, rdar://10238337
llvm-svn: 141215
-rw-r--r-- | clang/lib/AST/SelectorLocationsKind.cpp | 5 | ||||
-rw-r--r-- | clang/test/SemaObjC/protocol-archane.m | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/AST/SelectorLocationsKind.cpp b/clang/lib/AST/SelectorLocationsKind.cpp index 9a44b387dd8..671207a7f2d 100644 --- a/clang/lib/AST/SelectorLocationsKind.cpp +++ b/clang/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/clang/test/SemaObjC/protocol-archane.m b/clang/test/SemaObjC/protocol-archane.m index 138c43d1a83..992d3e4798c 100644 --- a/clang/test/SemaObjC/protocol-archane.m +++ b/clang/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 |