[cfe-commits] r161379 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenCXX/debug-info-template-array.cpp
Eric Christopher
echristo at apple.com
Mon Aug 6 17:48:43 PDT 2012
Author: echristo
Date: Mon Aug 6 19:48:43 2012
New Revision: 161379
URL: http://llvm.org/viewvc/llvm-project?rev=161379&view=rev
Log:
If we don't have a complete type for the array type yet either then
just let the alignment be zero.
PR13531
Added:
cfe/trunk/test/CodeGenCXX/debug-info-template-array.cpp
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=161379&r1=161378&r2=161379&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Aug 6 19:48:43 2012
@@ -1468,7 +1468,10 @@
CGM.getContext().getTypeAlign(CGM.getContext().getBaseElementType(VAT));
} else if (Ty->isIncompleteArrayType()) {
Size = 0;
- Align = CGM.getContext().getTypeAlign(Ty->getElementType());
+ if (Ty->getElementType()->isIncompleteType())
+ Align = 0;
+ else
+ Align = CGM.getContext().getTypeAlign(Ty->getElementType());
} else if (Ty->isDependentSizedArrayType() || Ty->isIncompleteType()) {
Size = 0;
Align = 0;
Added: cfe/trunk/test/CodeGenCXX/debug-info-template-array.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-template-array.cpp?rev=161379&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-template-array.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-template-array.cpp Mon Aug 6 19:48:43 2012
@@ -0,0 +1,14 @@
+// RUN: %clang -emit-llvm -g -S %s -o -
+// PR13531
+template <typename>
+struct unique_ptr {
+ unique_ptr() {}
+};
+
+template <unsigned>
+struct Vertex {};
+
+void crash() // Asserts
+{
+ unique_ptr<Vertex<2>[]> v = unique_ptr<Vertex<2>[]>();
+}
More information about the cfe-commits
mailing list