diff options
author | Anders Carlsson <andersca@mac.com> | 2007-11-01 00:39:26 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2007-11-01 00:39:26 +0000 |
commit | d6a275f9a27d1c91e4084398d04030719b5b8f18 (patch) | |
tree | 562f8600e51df2147d1908b92d34cf7fa077d3e4 | |
parent | c2527d1664bb1be21e8a9a43194e4267a9ff7ab4 (diff) |
Stub out codegen for __builtin_constant_p. Remove any implicit cast exprs in the call to __builtin___CFStringMakeConstantString.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43592 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | CodeGen/CGBuiltin.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/CodeGen/CGBuiltin.cpp b/CodeGen/CGBuiltin.cpp index ecac12b1f4..8cdf0685ca 100644 --- a/CodeGen/CGBuiltin.cpp +++ b/CodeGen/CGBuiltin.cpp @@ -40,8 +40,14 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { case Builtin::BI__builtin___CFStringMakeConstantString: { const Expr *Arg = E->getArg(0); - while (const ParenExpr *PE = dyn_cast<ParenExpr>(Arg)) - Arg = PE->getSubExpr(); + 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()); @@ -71,6 +77,14 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { return RValue::get(llvm::ConstantInt::get(Result)); } + case Builtin::BI__builtin_constant_p: { + llvm::APSInt Result(32); + + // FIXME: Analyze the parameter and check if it is a constant. + Result = 0; + + return RValue::get(llvm::ConstantInt::get(Result)); + } } return RValue::get(0); |