[PATCH] D53200: [OpenCL] Fix serialization of OpenCLExtensionDecls
Alexey Sachkov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 16 10:24:02 PDT 2018
AlexeySachkov updated this revision to Diff 169851.
AlexeySachkov added a comment.
Added 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,4 @@
+
+#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.ocl.pragma.ext.begin
+// RUN: mkdir -p %t.ocl.pragma.ext.begin
+//
+// 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.ocl.pragma.ext.begin %s 2>&1
+//
+// RUN: rm -rf %t.ocl.pragma.ext.begin
+// RUN: mkdir -p %t.ocl.pragma.ext.begin
+//
+// 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.ocl.pragma.ext.begin %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.169851.patch
Type: text/x-patch
Size: 1984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181016/93a19f87/attachment-0001.bin>
More information about the cfe-commits
mailing list