[cfe-commits] r43592 - /cfe/trunk/CodeGen/CGBuiltin.cpp

Anders Carlsson andersca at mac.com
Wed Oct 31 17:39:26 PDT 2007


Author: andersca
Date: Wed Oct 31 19:39:26 2007
New Revision: 43592

URL: http://llvm.org/viewvc/llvm-project?rev=43592&view=rev
Log:
Stub out codegen for __builtin_constant_p. Remove any implicit cast exprs in the call to __builtin___CFStringMakeConstantString.

Modified:
    cfe/trunk/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGBuiltin.cpp?rev=43592&r1=43591&r2=43592&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/CodeGen/CGBuiltin.cpp Wed Oct 31 19:39:26 2007
@@ -40,8 +40,14 @@
   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 @@
     
     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);





More information about the cfe-commits mailing list