aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--lib/CodeGen/CGExprConstant.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 0e31cacd1b..716e295f3e 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -625,6 +625,15 @@ public:
llvm::Constant *C = llvm::ConstantInt::get(llvm::Type::Int32Ty, id);
return llvm::ConstantExpr::getIntToPtr(C, ConvertType(E->getType()));
}
+ case Expr::CallExprClass: {
+ CallExpr* CE = cast<CallExpr>(E);
+ if (CE->isBuiltinCall() != Builtin::BI__builtin___CFStringMakeConstantString)
+ break;
+ const Expr *Arg = CE->getArg(0)->IgnoreParenCasts();
+ const StringLiteral *Literal = cast<StringLiteral>(Arg);
+ std::string S(Literal->getStrData(), Literal->getByteLength());
+ return CGM.GetAddrOfConstantCFString(S);
+ }
}
CGM.ErrorUnsupported(E, "constant l-value expression");
llvm::Type *Ty = llvm::PointerType::getUnqual(ConvertType(E->getType()));