Even if a constant's evaluated value is used, emit debug info for the constant variable.

llvm-svn: 110660
This commit is contained in:
Devang Patel
2010-08-10 07:24:25 +00:00
parent b219746c80
commit e03edfd3e7
6 changed files with 37 additions and 1 deletions

View File

@@ -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);
}