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
bool RewriteObjC::needToScanForQualifiers(QualType T) {
- if (T == Context->getObjCIdType())
- return true;
-
if (T->isObjCQualifiedIdType())
return true;
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)) {