Author: akirtzidis
Date: Wed Oct  5 16:28:06 2011
New Revision: 141215

URL: http://llvm.org/viewvc/llvm-project?rev=141215&view=rev
Log:
Fix crash when using archaic protocol, rdar://10238337

Modified:
    cfe/trunk/lib/AST/SelectorLocationsKind.cpp
    cfe/trunk/test/SemaObjC/protocol-archane.m

Modified: cfe/trunk/lib/AST/SelectorLocationsKind.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/SelectorLocationsKind.cpp?rev=141215&r1=141214&r2=141215&view=diff
==============================================================================
--- cfe/trunk/lib/AST/SelectorLocationsKind.cpp (original)
+++ cfe/trunk/lib/AST/SelectorLocationsKind.cpp Wed Oct  5 16:28:06 2011
@@ -54,8 +54,11 @@
 
 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>

Modified: cfe/trunk/test/SemaObjC/protocol-archane.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-archane.m?rev=141215&r1=141214&r2=141215&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-archane.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-archane.m Wed Oct  5 16:28:06 2011
@@ -33,3 +33,10 @@
 
 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


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to