From 15b2674896371ac2a0fe707b538a1a29dec9d8e4 Mon Sep 17 00:00:00 2001 From: Wei Pan Date: Mon, 26 Aug 2013 14:27:34 +0000 Subject: Handle predefined expression for a captured statement - __func__ or __FUNCTION__ returns captured statement's parent function name, not the one compiler generated. Differential Revision: http://llvm-reviews.chandlerc.com/D1491 Reviewed by bkramer git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189219 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index f5ca2d0974..2579d5bd63 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1972,6 +1972,10 @@ LValue CodeGenFunction::EmitPredefinedLValue(const PredefinedExpr *E) { // Blocks use the mangled function name. // FIXME: ComputeName should handle blocks. FunctionName = FnName.str(); + } else if (isa(CurDecl)) { + // For a captured statement, the function name is its enclosing + // function name not the one compiler generated. + FunctionName = PredefinedExpr::ComputeName(IdentType, CurDecl); } else { FunctionName = PredefinedExpr::ComputeName(IdentType, CurDecl); assert(cast(E->getType())->getSize() - 1 == -- cgit v1.2.3