]> granicus.if.org Git - clang/commitdiff
Sema::ActOnStartProtocolInterface(): Make sure the protocol decl has a valid start...
authorSteve Naroff <snaroff@apple.com>
Wed, 13 Aug 2008 16:39:22 +0000 (16:39 +0000)
committerSteve Naroff <snaroff@apple.com>
Wed, 13 Aug 2008 16:39:22 +0000 (16:39 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54740 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp

index e2c58c22a4e67495ac861225d41c67ac5bf842f0..28768fc56b26d8f5d4aa49c3c73e95101938a866 100644 (file)
@@ -199,7 +199,8 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
       // 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);