From: Anders Carlsson Date: Thu, 1 Nov 2007 00:39:26 +0000 (+0000) Subject: Stub out codegen for __builtin_constant_p. Remove any implicit cast exprs in the... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6a275f9a27d1c91e4084398d04030719b5b8f18;p=clang 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 --- 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(Arg)) - Arg = PE->getSubExpr(); + while (1) { + if (const ParenExpr *PE = dyn_cast(Arg)) + Arg = PE->getSubExpr(); + else if (const ImplicitCastExpr *CE = dyn_cast(Arg)) + Arg = CE->getSubExpr(); + else + break; + } const StringLiteral *Literal = cast(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);