forked from OSchip/llvm-project
With -fno-constant-cfstrrings, class NSConstantString
must be there or it is error (Next runtime). llvm-svn: 102223
This commit is contained in:
parent
e11ee11068
commit
0731763efc
|
@ -238,6 +238,8 @@ def err_duplicate_class_def : Error<
|
|||
"duplicate interface definition for class %0">;
|
||||
def err_undef_superclass : Error<
|
||||
"cannot find interface declaration for %0, superclass of %1">;
|
||||
def err_no_nsconstant_string_class : Error<
|
||||
"cannot find interface declaration for %0">;
|
||||
def err_recursive_superclass : Error<
|
||||
"trying to recursively use %0 as superclass of %1">;
|
||||
def warn_previous_alias_decl : Warning<"previously declared alias is ignored">;
|
||||
|
|
|
@ -78,6 +78,21 @@ Sema::ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs,
|
|||
QualType Ty = Context.getObjCConstantStringInterface();
|
||||
if (!Ty.isNull()) {
|
||||
Ty = Context.getObjCObjectPointerType(Ty);
|
||||
} else if (getLangOptions().NoConstantCFStrings) {
|
||||
IdentifierInfo *NSIdent = &Context.Idents.get("NSConstantString");
|
||||
NamedDecl *IF = LookupSingleName(TUScope, NSIdent, AtLocs[0],
|
||||
LookupOrdinaryName);
|
||||
if (ObjCInterfaceDecl *StrIF = dyn_cast_or_null<ObjCInterfaceDecl>(IF)) {
|
||||
Context.setObjCConstantStringInterface(StrIF);
|
||||
Ty = Context.getObjCConstantStringInterface();
|
||||
Ty = Context.getObjCObjectPointerType(Ty);
|
||||
} else {
|
||||
// If there is no NSConstantString interface defined then treat this
|
||||
// as error and recover from it.
|
||||
Diag(S->getLocStart(), diag::err_no_nsconstant_string_class) << NSIdent
|
||||
<< S->getSourceRange();
|
||||
Ty = Context.getObjCIdType();
|
||||
}
|
||||
} else {
|
||||
IdentifierInfo *NSIdent = &Context.Idents.get("NSString");
|
||||
NamedDecl *IF = LookupSingleName(TUScope, NSIdent, AtLocs[0],
|
||||
|
|
Loading…
Reference in New Issue