diff options
author | Chris Lattner <sabre@nondot.org> | 2008-10-06 07:26:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-10-06 07:26:43 +0000 |
commit | a97132a9c44d31dafa81db000340caed6218cee5 (patch) | |
tree | bca75815d6c9c582efb78ba74d368700dcba9356 /clang/lib/CodeGen/CGBuiltin.cpp | |
parent | 2c091b1ead0c834a63a1c9fbdb5a17537ae65fb7 (diff) | |
download | bcm5719-llvm-a97132a9c44d31dafa81db000340caed6218cee5.tar.gz bcm5719-llvm-a97132a9c44d31dafa81db000340caed6218cee5.zip |
Make sema and codegen allow __builtin___CFStringMakeConstantString as a valid
constant lvalue. Implement this in codegen by moving the code out of CGBuiltin
into EmitConstantExpr.
llvm-svn: 57163
Diffstat (limited to 'clang/lib/CodeGen/CGBuiltin.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index fc7cc027104..29d77b6e82b 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -48,23 +48,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { switch (BuiltinID) { default: break; // Handle intrinsics and libm functions below. - case Builtin::BI__builtin___CFStringMakeConstantString: { - const Expr *Arg = E->getArg(0); - - while (1) { - if (const ParenExpr *PE = dyn_cast<ParenExpr>(Arg)) - Arg = PE->getSubExpr(); - else if (const ImplicitCastExpr *CE = dyn_cast<ImplicitCastExpr>(Arg)) - Arg = CE->getSubExpr(); - else - break; - } - - const StringLiteral *Literal = cast<StringLiteral>(Arg); - std::string S(Literal->getStrData(), Literal->getByteLength()); - - return RValue::get(CGM.GetAddrOfConstantCFString(S)); - } + case Builtin::BI__builtin___CFStringMakeConstantString: + return RValue::get(CGM.EmitConstantExpr(E, 0)); case Builtin::BI__builtin_stdarg_start: case Builtin::BI__builtin_va_start: case Builtin::BI__builtin_va_end: { |