diff options
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
| -rw-r--r-- | lib/CodeGen/CGExpr.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 31da6df1ef..12aa0a2b7c 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -967,9 +967,15 @@ 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 or - // enumerator constant. - EmitValueDeclDbgValue(value, C); + // 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); + } // If we emitted a reference constant, we need to dereference that. if (resultIsReference) |
