aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-08-10 07:24:25 +0000
committerDevang Patel <dpatel@apple.com>2010-08-10 07:24:25 +0000
commit8d308384a220c7dc81755c47cdcbdd87dac25d5b (patch)
tree375ad9e9469e9377ce793ec7b2fd4f893fe36bf6 /lib/CodeGen/CodeGenFunction.cpp
parentbf87f2c1c6e2d8cb50902a6d79e8b170c19570d2 (diff)
Even if a constant's evaluated value is used, emit debug info for the constant variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index a3cd4f4c29..f992aa72e2 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -1284,3 +1284,17 @@ llvm::Value *CodeGenFunction::getEHCleanupDestSlot() {
CreateTempAlloca(Builder.getInt32Ty(), "eh.cleanup.dest.slot");
return EHCleanupDest;
}
+
+void CodeGenFunction::EmitDeclRefExprDbgValue(const DeclRefExpr *E,
+ const APValue &AV) {
+ CGDebugInfo *Dbg = getDebugInfo();
+ if (!Dbg) return;
+
+ llvm::Constant *C = NULL;
+ if (AV.isInt())
+ C = llvm::ConstantInt::get(getLLVMContext(), AV.getInt());
+ else if (AV.isFloat())
+ C = llvm::ConstantFP::get(getLLVMContext(), AV.getFloat());
+ if (C)
+ Dbg->EmitGlobalVariable(C, E->getDecl(), Builder);
+}