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
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index f5ca2d0..2579d5b 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -1972,6 +1972,10 @@
// Blocks use the mangled function name.
// FIXME: ComputeName should handle blocks.
FunctionName = FnName.str();
+ } else if (isa<CapturedDecl>(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<ConstantArrayType>(E->getType())->getSize() - 1 ==