summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorWei Pan <wei.pan@intel.com>2013-08-26 14:27:34 +0000
committerWei Pan <wei.pan@intel.com>2013-08-26 14:27:34 +0000
commit15b2674896371ac2a0fe707b538a1a29dec9d8e4 (patch)
treedda996fb331baeb386c2d26dbdd9469b341152f0 /lib/CodeGen/CGExpr.cpp
parent168de198e5b2333b9135a5c00546da558dbb8527 (diff)
downloadclang-15b2674896371ac2a0fe707b538a1a29dec9d8e4.tar.gz
clang-15b2674896371ac2a0fe707b538a1a29dec9d8e4.tar.bz2
clang-15b2674896371ac2a0fe707b538a1a29dec9d8e4.tar.xz
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
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp4
1 files changed, 4 insertions, 0 deletions
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<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 ==