diff options
author | Anders Carlsson <andersca@mac.com> | 2008-11-26 17:40:42 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2008-11-26 17:40:42 +0000 |
commit | 4d6e8dd587f6ae0080b0d3acc9ac6a6a02b1ac3b (patch) | |
tree | 79a34096ccf5959521088d26d55ade05049b1319 /lib/CodeGen/CGDebugInfo.cpp | |
parent | a8a6ef82ce903de65aee554f3d6c1c175de7da2f (diff) |
Convert incomplete array types before emitting debug info for them, fixes PR3134.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60109 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index e862808d12..d93bccd2ff 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -515,9 +515,22 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, uint64_t LineNo = SM.getLogicalLineNumber(Decl->getLocation()); std::string Name = Decl->getNameAsString(); - + + QualType T = Decl->getType(); + if (T->isIncompleteArrayType()) { + + // CodeGen turns int[] into int[1] so we'll do the same here. + llvm::APSInt ConstVal(32); + + ConstVal = 1; + QualType ET = M->getContext().getAsArrayType(T)->getElementType(); + + T = M->getContext().getConstantArrayType(ET, ConstVal, + ArrayType::Normal, 0); + } + DebugFactory.CreateGlobalVariable(Unit, Name, Name, "", Unit, LineNo, - getOrCreateType(Decl->getType(), Unit), + getOrCreateType(T, Unit), Var->hasInternalLinkage(), true/*definition*/, Var); } |