From 1ef0965bbd46a2915746ffe8067d411b18117415 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sun, 25 Jan 2009 02:10:46 +0000 Subject: [PATCH] Get rid of some code that should be unnecessary. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62950 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprConstant.cpp | 52 ---------------------------------- 1 file changed, 52 deletions(-) diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 716e295f3e..32d126e590 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -48,13 +48,6 @@ public: llvm::Constant *VisitParenExpr(ParenExpr *PE) { return Visit(PE->getSubExpr()); } - - llvm::Constant *VisitObjCStringLiteral(const ObjCStringLiteral *E) { - std::string S(E->getString()->getStrData(), - E->getString()->getByteLength()); - llvm::Constant *C = CGM.getObjCRuntime().GenerateConstantString(S); - return llvm::ConstantExpr::getBitCast(C, ConvertType(E->getType())); - } llvm::Constant *VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { return Visit(E->getInitializer()); @@ -371,54 +364,9 @@ public: return llvm::ConstantArray::get(CGM.GetStringForStringLiteral(E), false); } - llvm::Constant *VisitAddrLabelExpr(const AddrLabelExpr *E) { - assert(CGF && "Invalid address of label expression outside function."); - llvm::Constant *C = - llvm::ConstantInt::get(llvm::Type::Int32Ty, - CGF->GetIDForAddrOfLabel(E->getLabel())); - return llvm::ConstantExpr::getIntToPtr(C, ConvertType(E->getType())); - } - - llvm::Constant *VisitUnaryAddrOf(const UnaryOperator *E) { - return EmitLValue(E->getSubExpr()); - } - llvm::Constant *VisitUnaryOffsetOf(const UnaryOperator *E) { - int64_t Val = E->evaluateOffsetOf(CGM.getContext()); - - assert(E->getType()->isIntegerType() && "Result type must be an integer!"); - - uint32_t ResultWidth = - static_cast(CGM.getContext().getTypeSize(E->getType())); - return llvm::ConstantInt::get(llvm::APInt(ResultWidth, Val)); - } - llvm::Constant *VisitUnaryExtension(const UnaryOperator *E) { return Visit(E->getSubExpr()); } - - // Binary operators - - llvm::Constant *VisitCallExpr(const CallExpr *E) { - Expr::EvalResult Result; - if (E->Evaluate(Result, CGM.getContext())) { - if (Result.Val.isInt()) - return llvm::ConstantInt::get(Result.Val.getInt()); - if (Result.Val.isFloat()) - return llvm::ConstantFP::get(Result.Val.getFloat()); - } - - // Handle __builtin___CFStringMakeConstantString. - if (E->isBuiltinCall() ==Builtin::BI__builtin___CFStringMakeConstantString){ - const Expr *Arg = E->getArg(0)->IgnoreParenCasts(); - - const StringLiteral *Literal = cast(Arg); - std::string S(Literal->getStrData(), Literal->getByteLength()); - return CGM.GetAddrOfConstantCFString(S); - } - - CGM.ErrorUnsupported(E, "constant call expression"); - return llvm::Constant::getNullValue(ConvertType(E->getType())); - } // Utility methods const llvm::Type *ConvertType(QualType T) { -- 2.40.0