[cfe-commits] r141215 - in /cfe/trunk: lib/AST/SelectorLocationsKind.cpp test/SemaObjC/protocol-archane.m

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Oct 5 14:28:07 PDT 2011


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
+ at protocol Broken @end
+ at interface Crash @end
+ at implementation Crash
+- (void)crashWith:(<Broken>)a { // expected-warning {{protocol qualifiers without 'id' is archaic}}
+}
+ at end





More information about the cfe-commits mailing list