summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2013-08-30 05:37:02 +0000
committerYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2013-08-30 05:37:02 +0000
commitbe8d7ba93a5e19017096faaf5df54335a6d52000 (patch)
tree2075bfb4188bd16bfa22392c4b4fab81f47bd777 /clang/lib/CodeGen/CGExpr.cpp
parentb7ecc3e6afefc521fb0aa1e48ff3e64e34a46b8e (diff)
downloadbcm5719-llvm-be8d7ba93a5e19017096faaf5df54335a6d52000.tar.gz
bcm5719-llvm-be8d7ba93a5e19017096faaf5df54335a6d52000.zip
Fixing a bug where debug info for a local variable gets emitted at file scope.
The patch was discussed in Phabricator. See: http://llvm-reviews.chandlerc.com/D1281 llvm-svn: 189649
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 12aa0a2b7c4..31da6df1efa 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -967,15 +967,9 @@ CodeGenFunction::tryEmitAsConstant(DeclRefExpr *refExpr) {
// Emit as a constant.
llvm::Constant *C = CGM.EmitConstantValue(result.Val, resultType, this);
- // Make sure we emit a debug reference to the global variable.
- // This should probably fire even for
- if (isa<VarDecl>(value)) {
- if (!getContext().DeclMustBeEmitted(cast<VarDecl>(value)))
- EmitDeclRefExprDbgValue(refExpr, C);
- } else {
- assert(isa<EnumConstantDecl>(value));
- EmitDeclRefExprDbgValue(refExpr, C);
- }
+ // Make sure we emit a debug reference to the global variable or
+ // enumerator constant.
+ EmitValueDeclDbgValue(value, C);
// If we emitted a reference constant, we need to dereference that.
if (resultIsReference)
OpenPOWER on IntegriCloud