[PATCH] D53200: [OpenCL] Fix serialization of OpenCLExtensionDecls

Alexey Sachkov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 17 03:12:37 PDT 2018


AlexeySachkov updated this revision to Diff 169978.
AlexeySachkov added a comment.

Removed unnecessary empty line from test


https://reviews.llvm.org/D53200

Files:
  lib/Serialization/ASTWriter.cpp
  test/Headers/opencl-pragma-extension-begin.cl
  test/Headers/opencl-pragma-extension-begin.h


Index: test/Headers/opencl-pragma-extension-begin.h
===================================================================
--- /dev/null
+++ test/Headers/opencl-pragma-extension-begin.h
@@ -0,0 +1,3 @@
+#pragma OPENCL EXTENSION cl_my_ext : begin
+void cl_my_ext_foo();
+#pragma OPENCL EXTENSION cl_my_ext : end
Index: test/Headers/opencl-pragma-extension-begin.cl
===================================================================
--- /dev/null
+++ test/Headers/opencl-pragma-extension-begin.cl
@@ -0,0 +1,13 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+//
+// RUN: %clang_cc1 -cl-std=CL1.2 -include %S/opencl-pragma-extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s 2>&1
+//
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+//
+// RUN: %clang_cc1 -cl-std=CL2.0 -include %S/opencl-pragma-extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s 2>&1
+
+void __kernel test(__global int *data) {
+  *data = 10;
+}
Index: lib/Serialization/ASTWriter.cpp
===================================================================
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -5014,13 +5014,16 @@
   WriteFPPragmaOptions(SemaRef.getFPOptions());
   WriteOpenCLExtensions(SemaRef);
   WriteOpenCLExtensionTypes(SemaRef);
-  WriteOpenCLExtensionDecls(SemaRef);
   WriteCUDAPragmas(SemaRef);
 
   // If we're emitting a module, write out the submodule information.
   if (WritingModule)
     WriteSubmodules(WritingModule);
 
+  // We need to have information about submodules to correctly deserialize
+  // decls from OpenCLExtensionDecls block
+  WriteOpenCLExtensionDecls(SemaRef);
+
   Stream.EmitRecord(SPECIAL_TYPES, SpecialTypes);
 
   // Write the record containing external, unnamed definitions.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53200.169978.patch
Type: text/x-patch
Size: 1856 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181017/4c3b25de/attachment.bin>


More information about the cfe-commits mailing list