diff options
author | Devang Patel <dpatel@apple.com> | 2010-08-10 07:24:25 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-08-10 07:24:25 +0000 |
commit | e03edfd3e7d883bb671fb3cd5ca94ffb470e5cfa (patch) | |
tree | 099dae5eb9cf57beea7ced4b01dc9d2be27dbf67 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | b219746c80be195e914d6f620427217818476ba8 (diff) | |
download | bcm5719-llvm-e03edfd3e7d883bb671fb3cd5ca94ffb470e5cfa.tar.gz bcm5719-llvm-e03edfd3e7d883bb671fb3cd5ca94ffb470e5cfa.zip |
Even if a constant's evaluated value is used, emit debug info for the constant variable.
llvm-svn: 110660
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index a3cd4f4c29c..f992aa72e2e 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/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); +} |