From 8d308384a220c7dc81755c47cdcbdd87dac25d5b Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Tue, 10 Aug 2010 07:24:25 +0000 Subject: 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 --- lib/CodeGen/CodeGenFunction.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/CodeGen/CodeGenFunction.cpp') 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); +} -- cgit v1.2.3-18-g5258