aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-04-04 23:18:38 +0000
committerDevang Patel <dpatel@apple.com>2011-04-04 23:18:38 +0000
commitba690a4112be4f0abde48ce51d41e92c79f96f3e (patch)
tree9fc30a7c3929655d0674dac817e169d87bd095bc
parenta71acfe2e3d065fd32e457f46d46da32a09c62c8 (diff)
Incomplete type does not have any size.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128855 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp2
-rw-r--r--test/CodeGenCXX/debug-info-template.cpp14
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index c7a50efcd8..cf147502c5 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1226,7 +1226,7 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty,
} else if (Ty->isIncompleteArrayType()) {
Size = 0;
Align = CGM.getContext().getTypeAlign(Ty->getElementType());
- } else if (Ty->isDependentSizedArrayType()) {
+ } else if (Ty->isDependentSizedArrayType() || Ty->isIncompleteType()) {
Size = 0;
Align = 0;
} else if (Ty->getElementType()->getTypeClass()
diff --git a/test/CodeGenCXX/debug-info-template.cpp b/test/CodeGenCXX/debug-info-template.cpp
index 8560c5a8e9..9d52159bed 100644
--- a/test/CodeGenCXX/debug-info-template.cpp
+++ b/test/CodeGenCXX/debug-info-template.cpp
@@ -30,3 +30,17 @@ struct Test {
};
static Test test;
+// PR9608
+template <int i> struct TheTemplate {
+ struct Empty2 {};
+ typedef const Empty2 DependentType[i];
+ TheTemplate() {}
+};
+
+class TheTemplateTest : public TheTemplate<42> {
+ TheTemplateTest();
+ void method(const TheTemplate<42>::DependentType *) {}
+};
+
+TheTemplateTest::TheTemplateTest() : TheTemplate<42>() {}
+