summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-04-23 23:19:04 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-04-23 23:19:04 +0000
commit0731763efc6f8097e167f6bfefe4fcb75926cba9 (patch)
treeae33c9f90c2f658342000e761aa6a10df9388fb9 /clang/lib/Sema/SemaExprObjC.cpp
parente11ee11068a875f014e7ed696d75af31ec1bac83 (diff)
downloadbcm5719-llvm-0731763efc6f8097e167f6bfefe4fcb75926cba9.tar.gz
bcm5719-llvm-0731763efc6f8097e167f6bfefe4fcb75926cba9.zip
With -fno-constant-cfstrrings, class NSConstantString
must be there or it is error (Next runtime). llvm-svn: 102223
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index fcf2df6987c..db9a2e238f9 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -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],
OpenPOWER on IntegriCloud