[cfe-commits] r54740 - /cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Steve Naroff snaroff at apple.com
Wed Aug 13 09:39:25 PDT 2008


Author: snaroff
Date: Wed Aug 13 11:39:22 2008
New Revision: 54740

URL: http://llvm.org/viewvc/llvm-project?rev=54740&view=rev
Log:
Sema::ActOnStartProtocolInterface(): Make sure the protocol decl has a valid start location.

The following case resulted in an invalid start location:

// start location not being set for ObjCProtocolDecl AST (when a forward reference is in scope).
@protocol Buggy;

@protocol Buggy 
@optional
- whatever;
@end


Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=54740&r1=54739&r2=54740&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Aug 13 11:39:22 2008
@@ -199,7 +199,8 @@
       // FIXME: don't leak the objects passed in!
       return PDecl;
     }
-    
+    // Make sure the cached decl gets a valid start location.
+    PDecl->setLocation(AtProtoInterfaceLoc);
     PDecl->setForwardDecl(false);
   } else {
     PDecl = ObjCProtocolDecl::Create(Context, AtProtoInterfaceLoc,ProtocolName);





More information about the cfe-commits mailing list