]> granicus.if.org Git - clang/commitdiff
Fix the rewriter, rdar://10234024.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 5 Oct 2011 19:37:56 +0000 (19:37 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 5 Oct 2011 19:37:56 +0000 (19:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141201 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp
test/Rewriter/protocol-rewrite-2.m [new file with mode: 0644]

index c1c000e030819ed785ded5f1785a0329692add01..de48de15d77c405549078c89b02a4670ca2be5b2 100644 (file)
@@ -586,7 +586,8 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
             ProtocolName, ProtocolLoc, PDecl->getLocation(), PList);
 
     // Make sure the cached decl gets a valid start location.
-    PDecl->setLocation(AtProtoInterfaceLoc);
+    PDecl->setAtStartLoc(AtProtoInterfaceLoc);
+    PDecl->setLocation(ProtocolLoc);
     PDecl->setForwardDecl(false);
     // Since this ObjCProtocolDecl was created by a forward declaration,
     // we now add it to the DeclContext since it wasn't added before
diff --git a/test/Rewriter/protocol-rewrite-2.m b/test/Rewriter/protocol-rewrite-2.m
new file mode 100644 (file)
index 0000000..b3eb16a
--- /dev/null
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -rewrite-objc %s -o %t.cpp
+// RUN: %clang_cc1 -fsyntax-only %t.cpp
+
+// rdar://10234024
+@protocol Foo;
+@protocol Foo
+@end