diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-01-20 01:19:17 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-01-20 01:19:17 +0000 |
commit | a89701bb49601235b8dabafccf10ca4b2efed0e2 (patch) | |
tree | 7782df6406115e8f2d123b8f57116f3d0939a0d7 /lib/CodeGen/CGDebugInfo.cpp | |
parent | 0116a40116616701282e12f3d92cf2949102d76a (diff) |
The last of PR14471: Debug info support for inline in-class initializer for float static members
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172942 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 27ccc3b494..37df4b33ce 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -842,11 +842,15 @@ CollectRecordStaticField(const VarDecl *Var, unsigned LineNumber = getLineNumber(Var->getLocation()); StringRef VName = Var->getName(); - llvm::ConstantInt *CI = NULL; + llvm::Constant *C = NULL; if (Var->getInit()) { const APValue *Value = Var->evaluateValue(); - if (Value && Value->isInt()) - CI = llvm::ConstantInt::get(CGM.getLLVMContext(), Value->getInt()); + if (Value) { + if (Value->isInt()) + C = llvm::ConstantInt::get(CGM.getLLVMContext(), Value->getInt()); + if (Value->isFloat()) + C = llvm::ConstantFP::get(CGM.getLLVMContext(), Value->getFloat()); + } } unsigned Flags = 0; @@ -857,7 +861,7 @@ CollectRecordStaticField(const VarDecl *Var, Flags |= llvm::DIDescriptor::FlagProtected; llvm::DIType GV = DBuilder.createStaticMemberType(RecordTy, VName, VUnit, - LineNumber, VTy, Flags, CI); + LineNumber, VTy, Flags, C); elements.push_back(GV); StaticDataMemberCache[Var->getCanonicalDecl()] = llvm::WeakVH(GV); } |