diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-07-28 21:38:49 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-07-28 21:38:49 +0000 |
commit | 04f5c31e98108b5ab4dd5f5df98072191bdc2b00 (patch) | |
tree | 0557aae42a22df45fbb25b2ca61504b931b290d9 | |
parent | 377a8ed91339e3c60a4d203bf30fa6b5c6f88918 (diff) | |
download | bcm5719-llvm-04f5c31e98108b5ab4dd5f5df98072191bdc2b00.tar.gz bcm5719-llvm-04f5c31e98108b5ab4dd5f5df98072191bdc2b00.zip |
Support extended vector types in chained PCH.
llvm-svn: 109675
-rw-r--r-- | clang/lib/Frontend/PCHReader.cpp | 11 | ||||
-rw-r--r-- | clang/test/PCH/Inputs/chain-ext_vector1.h | 3 | ||||
-rw-r--r-- | clang/test/PCH/Inputs/chain-ext_vector2.h | 3 | ||||
-rw-r--r-- | clang/test/PCH/chain-ext_vector.c | 11 |
4 files changed, 23 insertions, 5 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp index bdc02020b40..69922b0d0fa 100644 --- a/clang/lib/Frontend/PCHReader.cpp +++ b/clang/lib/Frontend/PCHReader.cpp @@ -1685,11 +1685,12 @@ PCHReader::ReadPCHBlock(PerFileData &F) { } 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: diff --git a/clang/test/PCH/Inputs/chain-ext_vector1.h b/clang/test/PCH/Inputs/chain-ext_vector1.h new file mode 100644 index 00000000000..51093364c92 --- /dev/null +++ b/clang/test/PCH/Inputs/chain-ext_vector1.h @@ -0,0 +1,3 @@ +// First header file for chain-ext_vector.c PCH test + +typedef __attribute__((ext_vector_type(2))) float float2; diff --git a/clang/test/PCH/Inputs/chain-ext_vector2.h b/clang/test/PCH/Inputs/chain-ext_vector2.h new file mode 100644 index 00000000000..bdaeccc130e --- /dev/null +++ b/clang/test/PCH/Inputs/chain-ext_vector2.h @@ -0,0 +1,3 @@ +// Second header file for chain-ext_vector.c PCH test + +typedef __attribute__((ext_vector_type(4))) float float4; diff --git a/clang/test/PCH/chain-ext_vector.c b/clang/test/PCH/chain-ext_vector.c new file mode 100644 index 00000000000..263507003d1 --- /dev/null +++ b/clang/test/PCH/chain-ext_vector.c @@ -0,0 +1,11 @@ +// 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}} +} |