}
case pch::EXT_VECTOR_DECLS:
- if (!ExtVectorDecls.empty()) {
- Error("duplicate EXT_VECTOR_DECLS record in PCH file");
- return Failure;
- }
- ExtVectorDecls.swap(Record);
+ // Optimization for the first block.
+ if (ExtVectorDecls.empty())
+ ExtVectorDecls.swap(Record);
+ else
+ ExtVectorDecls.insert(ExtVectorDecls.end(),
+ Record.begin(), Record.end());
break;
case pch::VTABLE_USES:
--- /dev/null
+// First header file for chain-ext_vector.c PCH test
+
+typedef __attribute__((ext_vector_type(2))) float float2;
--- /dev/null
+// Second header file for chain-ext_vector.c PCH test
+
+typedef __attribute__((ext_vector_type(4))) float float4;
--- /dev/null
+// Test this without pch.
+// RUN: %clang_cc1 -include %S/Inputs/chain-ext_vector1.h -include %S/Inputs/chain-ext_vector2.h -fsyntax-only -verify %s
+
+// Test with pch.
+// RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-ext_vector1.h
+// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-ext_vector2.h -include-pch %t1 -chained-pch
+// RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s
+
+int test(float4 f4) {
+ return f4.xy; // expected-error{{float2}}
+}