diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-12-16 22:10:52 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-12-16 22:10:52 +0000 |
commit | b701363188059fe6bfa33f7b4cbbb8babef651fc (patch) | |
tree | d58485adc8d2a9964d569e81d1bd6565e4f4eed0 /clang/lib/CodeGen | |
parent | 18b7d82e960b6254f5cf99b5ccf2641aa4cc7c3f (diff) | |
download | bcm5719-llvm-b701363188059fe6bfa33f7b4cbbb8babef651fc.tar.gz bcm5719-llvm-b701363188059fe6bfa33f7b4cbbb8babef651fc.zip |
IRGen: Fix assertion failure when creating debug info for an integer constant wider than 64 bits.
llvm-svn: 289996
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 9b53152fac4..2bce8043311 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3759,12 +3759,15 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, const APValue &Init) { if (GV) return; llvm::DIExpression *InitExpr = nullptr; - if (Init.isInt()) - InitExpr = - DBuilder.createConstantValueExpression(Init.getInt().getExtValue()); - else if (Init.isFloat() && CGM.getContext().getTypeSize(VD->getType()) <= 64) - InitExpr = DBuilder.createConstantValueExpression( - Init.getFloat().bitcastToAPInt().getZExtValue()); + if (CGM.getContext().getTypeSize(VD->getType()) <= 64) { + // FIXME: Add a representation for integer constants wider than 64 bits. + if (Init.isInt()) + InitExpr = + DBuilder.createConstantValueExpression(Init.getInt().getExtValue()); + else if (Init.isFloat()) + InitExpr = DBuilder.createConstantValueExpression( + Init.getFloat().bitcastToAPInt().getZExtValue()); + } GV.reset(DBuilder.createGlobalVariable( DContext, Name, StringRef(), Unit, getLineNumber(VD->getLocation()), Ty, true, InitExpr, getOrCreateStaticDataMemberDeclarationOrNull(VarD), |