summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2013-08-30 08:53:09 +0000
committerYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2013-08-30 08:53:09 +0000
commit3b8e0b7f96164e8c49d2a833da26edd960f5da1f (patch)
treeed8b1ed4d3fef3b621526debda20a64c469b4c12 /lib/CodeGen/CGExpr.cpp
parent66ea35d9f3d93cab3ca6d735c8eb19a5f701b86f (diff)
downloadclang-3b8e0b7f96164e8c49d2a833da26edd960f5da1f.tar.gz
clang-3b8e0b7f96164e8c49d2a833da26edd960f5da1f.tar.bz2
clang-3b8e0b7f96164e8c49d2a833da26edd960f5da1f.tar.xz
Revert r189649 because it was breaking sanitizer bots.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp12
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)