]> granicus.if.org Git - clang/commitdiff
Fix <rdar://problem/5969777> clang ObjC rewriter: #imported file name mysteriously...
authorSteve Naroff <snaroff@apple.com>
Sat, 31 May 2008 05:02:17 +0000 (05:02 +0000)
committerSteve Naroff <snaroff@apple.com>
Sat, 31 May 2008 05:02:17 +0000 (05:02 +0000)
This fix involved tightening up needToScanForQualifiers(), which predated ObjCQualifiedIdType.
It also includes a minor tweak to the code that searches for the beginning of the qualified type. If the AST contained the correct beginning of the declaration (i.e. the beginning of the declaration specifiers), this code would be more robust. Since it doesn't, we apply an adhoc heuristic. Note that DeclSpec contains this info...we just don't propagate it to the AST (at present).

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

Driver/RewriteObjC.cpp

index d1c6b9710a6808801e1f96d3c5923cb2125a7d20..4d524a4a6dff09baf5a857903adfec6daef8d599 100644 (file)
@@ -1520,9 +1520,6 @@ static void scanToNextArgument(const char *&argRef) {
 
 bool RewriteObjC::needToScanForQualifiers(QualType T) {
   
-  if (T == Context->getObjCIdType())
-    return true;
-    
   if (T->isObjCQualifiedIdType())
     return true;
   
@@ -1561,7 +1558,7 @@ void RewriteObjC::RewriteObjCQualifiedInterfaceTypes(Decl *Dcl) {
     
     const char *endBuf = SM->getCharacterData(Loc);
     const char *startBuf = endBuf;
-    while (*startBuf != ';' && startBuf != MainFileStart)
+    while (*startBuf != ';' && *startBuf != '<' && startBuf != MainFileStart)
       startBuf--; // scan backward (from the decl location) for return type.
     const char *startRef = 0, *endRef = 0;
     if (scanForProtocolRefs(startBuf, endBuf, startRef, endRef)) {