From 51a31e1da76cc0906e4708ae15e2f7ecf1ba5f13 Mon Sep 17 00:00:00 2001 From: Yunzhong Gao Date: Fri, 30 Aug 2013 05:37:02 +0000 Subject: 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189649 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 12aa0a2b7c..31da6df1ef 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/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(value)) { - if (!getContext().DeclMustBeEmitted(cast(value))) - EmitDeclRefExprDbgValue(refExpr, C); - } else { - assert(isa(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) -- cgit v1.2.3