diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-24 22:18:39 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-24 22:18:39 +0000 |
commit | eaf2bb89eb2aad3b80673de30febe52df43c10ec (patch) | |
tree | f6b8b9fd6f0e42047f23937bb34139ddface6a4b /lib/CodeGen/CGExpr.cpp | |
parent | 8459132b0302cde7eb2a21eb2c6ffca9e66e3aea (diff) |
first wave of fixes for @encode sema support. This is part of PR3648.
The big difference here is that (like string literal) @encode has
array type, not pointer type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 0449900a0f..e353ab49c3 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -148,6 +148,8 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) { return EmitPredefinedLValue(cast<PredefinedExpr>(E)); case Expr::StringLiteralClass: return EmitStringLiteralLValue(cast<StringLiteral>(E)); + case Expr::ObjCEncodeExprClass: + return EmitObjCEncodeExprLValue(cast<ObjCEncodeExpr>(E)); case Expr::CXXConditionDeclExprClass: return EmitCXXConditionDeclLValue(cast<CXXConditionDeclExpr>(E)); @@ -668,7 +670,8 @@ LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) { default: assert(0 && "Unknown unary operator lvalue!"); case UnaryOperator::Deref: { - QualType T = E->getSubExpr()->getType()->getAsPointerType()->getPointeeType(); + QualType T = + E->getSubExpr()->getType()->getAsPointerType()->getPointeeType(); LValue LV = LValue::MakeAddr(EmitScalarExpr(E->getSubExpr()), ExprTy->getAsPointerType()->getPointeeType() .getCVRQualifiers(), @@ -697,22 +700,27 @@ LValue CodeGenFunction::EmitStringLiteralLValue(const StringLiteral *E) { return LValue::MakeAddr(CGM.GetAddrOfConstantStringFromLiteral(E), 0); } +LValue CodeGenFunction::EmitObjCEncodeExprLValue(const ObjCEncodeExpr *E) { + return LValue::MakeAddr(CGM.GetAddrOfConstantStringFromObjCEncode(E), 0); +} + + LValue CodeGenFunction::EmitPredefinedFunctionName(unsigned Type) { std::string GlobalVarName; switch (Type) { - default: - assert(0 && "Invalid type"); - case PredefinedExpr::Func: - GlobalVarName = "__func__."; - break; - case PredefinedExpr::Function: - GlobalVarName = "__FUNCTION__."; - break; - case PredefinedExpr::PrettyFunction: - // FIXME:: Demangle C++ method names - GlobalVarName = "__PRETTY_FUNCTION__."; - break; + default: + assert(0 && "Invalid type"); + case PredefinedExpr::Func: + GlobalVarName = "__func__."; + break; + case PredefinedExpr::Function: + GlobalVarName = "__FUNCTION__."; + break; + case PredefinedExpr::PrettyFunction: + // FIXME:: Demangle C++ method names + GlobalVarName = "__PRETTY_FUNCTION__."; + break; } std::string FunctionName; |