Change the type of ObjCStringLiteral from "struct __builtin_CFString *" to "NSConstantString *".
This makes the typecheck much happier. Without this change, the type checker would have to special case "struct __builtin_CFString *". This change does assume the interface for NSConstantString is declared in the translation unit.
I left ASTContext::getCFConstantStringType() around for now (with a comment that says it is currently unused).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43021 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp
index 86cf13c..366966f 100644
--- a/AST/ASTContext.cpp
+++ b/AST/ASTContext.cpp
@@ -150,6 +150,7 @@
BuiltinVaListType = QualType();
ObjcIdType = QualType();
IdStructType = 0;
+ ObjcConstantStringType = QualType();
}
//===----------------------------------------------------------------------===//
@@ -855,6 +856,13 @@
IdStructType = rec;
}
+void ASTContext::setObjcConstantStringInterface(ObjcInterfaceDecl *Decl) {
+ assert(ObjcConstantStringType.isNull() &&
+ "'NSConstantString' type already set!");
+
+ ObjcConstantStringType = getObjcInterfaceType(Decl);
+}
+
bool ASTContext::builtinTypesAreCompatible(QualType lhs, QualType rhs) {
const BuiltinType *lBuiltin = lhs->getAsBuiltinType();
const BuiltinType *rBuiltin = rhs->getAsBuiltinType();