From 2f343dd5c83d659d52c217c251ffd1fbcd018110 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 21 Apr 2009 23:00:09 +0000 Subject: [PATCH] fix PR4026: Clang can't codegen __func__ without implicit cast llvm-svn: 69747 --- clang/lib/CodeGen/CGExprAgg.cpp | 15 +++++++++------ clang/test/CodeGen/exprs.c | 5 +++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 9d6df5c820d5..2e45f2017b42 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -64,16 +64,19 @@ public: void VisitMemberExpr(MemberExpr *ME) { EmitAggLoadOfLValue(ME); } void VisitUnaryDeref(UnaryOperator *E) { EmitAggLoadOfLValue(E); } void VisitStringLiteral(StringLiteral *E) { EmitAggLoadOfLValue(E); } - void VisitCompoundLiteralExpr(CompoundLiteralExpr *E) - { EmitAggLoadOfLValue(E); } - + void VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { + EmitAggLoadOfLValue(E); + } void VisitArraySubscriptExpr(ArraySubscriptExpr *E) { EmitAggLoadOfLValue(E); } + void VisitBlockDeclRefExpr(const BlockDeclRefExpr *E) { + EmitAggLoadOfLValue(E); + } + void VisitPredefinedExpr(const PredefinedExpr *E) { + EmitAggLoadOfLValue(E); + } - void VisitBlockDeclRefExpr(const BlockDeclRefExpr *E) - { EmitAggLoadOfLValue(E); } - // Operators. // case Expr::UnaryOperatorClass: // case Expr::CastExprClass: diff --git a/clang/test/CodeGen/exprs.c b/clang/test/CodeGen/exprs.c index 0e74b8c77322..f80ee4195803 100644 --- a/clang/test/CodeGen/exprs.c +++ b/clang/test/CodeGen/exprs.c @@ -94,3 +94,8 @@ struct s6 { int f0; }; int f6(int a0, struct s6 a1, struct s6 a2) { return (a0 ? a1 : a2).f0; } + +// PR4026 +void f7() { + __func__; +}