[cfe-commits] r109675 - in /cfe/trunk: lib/Frontend/PCHReader.cpp test/PCH/Inputs/chain-ext_vector1.h test/PCH/Inputs/chain-ext_vector2.h test/PCH/chain-ext_vector.c

Sebastian Redl sebastian.redl at getdesigned.at
Wed Jul 28 14:38:50 PDT 2010


Author: cornedbee
Date: Wed Jul 28 16:38:49 2010
New Revision: 109675

URL: http://llvm.org/viewvc/llvm-project?rev=109675&view=rev
Log:
Support extended vector types in chained PCH.

Added:
    cfe/trunk/test/PCH/Inputs/chain-ext_vector1.h
    cfe/trunk/test/PCH/Inputs/chain-ext_vector2.h
    cfe/trunk/test/PCH/chain-ext_vector.c
Modified:
    cfe/trunk/lib/Frontend/PCHReader.cpp

Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=109675&r1=109674&r2=109675&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Wed Jul 28 16:38:49 2010
@@ -1685,11 +1685,12 @@
     }
 
     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:

Added: cfe/trunk/test/PCH/Inputs/chain-ext_vector1.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/Inputs/chain-ext_vector1.h?rev=109675&view=auto
==============================================================================
--- cfe/trunk/test/PCH/Inputs/chain-ext_vector1.h (added)
+++ cfe/trunk/test/PCH/Inputs/chain-ext_vector1.h Wed Jul 28 16:38:49 2010
@@ -0,0 +1,3 @@
+// First header file for chain-ext_vector.c PCH test
+
+typedef __attribute__((ext_vector_type(2))) float float2;

Added: cfe/trunk/test/PCH/Inputs/chain-ext_vector2.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/Inputs/chain-ext_vector2.h?rev=109675&view=auto
==============================================================================
--- cfe/trunk/test/PCH/Inputs/chain-ext_vector2.h (added)
+++ cfe/trunk/test/PCH/Inputs/chain-ext_vector2.h Wed Jul 28 16:38:49 2010
@@ -0,0 +1,3 @@
+// Second header file for chain-ext_vector.c PCH test
+
+typedef __attribute__((ext_vector_type(4))) float float4;

Added: cfe/trunk/test/PCH/chain-ext_vector.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/chain-ext_vector.c?rev=109675&view=auto
==============================================================================
--- cfe/trunk/test/PCH/chain-ext_vector.c (added)
+++ cfe/trunk/test/PCH/chain-ext_vector.c Wed Jul 28 16:38:49 2010
@@ -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}}
+}





More information about the cfe-commits mailing list