summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2012-08-07 00:48:43 +0000
committerEric Christopher <echristo@apple.com>2012-08-07 00:48:43 +0000
commit06d29572e1c7d57fb8fca6cd8e8707a4ecb498cd (patch)
tree4f72c229ba762efed4d02511594a973b63b75afd
parenteb06a2e518746c4025aeda06e9ea89278fd94758 (diff)
downloadbcm5719-llvm-06d29572e1c7d57fb8fca6cd8e8707a4ecb498cd.tar.gz
bcm5719-llvm-06d29572e1c7d57fb8fca6cd8e8707a4ecb498cd.zip
If we don't have a complete type for the array type yet either then
just let the alignment be zero. PR13531 llvm-svn: 161379
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp5
-rw-r--r--clang/test/CodeGenCXX/debug-info-template-array.cpp14
2 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 00555674f0f..379d1585a5d 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1468,7 +1468,10 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty,
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;
diff --git a/clang/test/CodeGenCXX/debug-info-template-array.cpp b/clang/test/CodeGenCXX/debug-info-template-array.cpp
new file mode 100644
index 00000000000..305327bbe09
--- /dev/null
+++ b/clang/test/CodeGenCXX/debug-info-template-array.cpp
@@ -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>[]>();
+}
OpenPOWER on IntegriCloud