Debian Codegraph @

llvm-project/llvm/projects/opencl-clang/patches/clang/0001-Remove-__IMAGE_SUPPORT__-macro-for-SPIR.patch

raw
1 From 1ca45b5f5725a447ded14c0096df39f2751c4e9a Mon Sep 17 00:00:00 2001
2 From: Haonan Yang <[email protected]>
3 Date: Fri, 25 Feb 2022 10:36:57 +0800
4 Subject: [PATCH] Remove __IMAGE_SUPPORT__ macro for SPIR
5
6 Signed-off-by: Haonan Yang <[email protected]>
7
8 diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
9 index 208c6a8db159..33c8409eaf12 100644
10 --- a/clang/lib/Frontend/InitPreprocessor.cpp
11 +++ b/clang/lib/Frontend/InitPreprocessor.cpp
12 @@ -1288,9 +1288,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
13 // OpenCL definitions.
14 if (LangOpts.OpenCL) {
15 InitializeOpenCLFeatureTestMacros(TI, LangOpts, Builder);
16 -
17 - if (TI.getTriple().isSPIR() || TI.getTriple().isSPIRV())
18 - Builder.defineMacro("__IMAGE_SUPPORT__");
19 }
20
21 if (TI.hasInt128Type() && LangOpts.CPlusPlus && LangOpts.GNUMode) {
22 diff --git a/clang/test/Preprocessor/predefined-macros.c b/clang/test/Preprocessor/predefined-macros.c
23 index d77b699674af..4dd02c3cfde4 100644
24 --- a/clang/test/Preprocessor/predefined-macros.c
25 +++ b/clang/test/Preprocessor/predefined-macros.c
26 @@ -210,28 +210,24 @@
27
28 // RUN: %clang_cc1 %s -E -dM -o - -x cl -triple spir-unknown-unknown \
29 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SPIR
30 -// CHECK-SPIR-DAG: #define __IMAGE_SUPPORT__ 1
31 // CHECK-SPIR-DAG: #define __SPIR__ 1
32 // CHECK-SPIR-DAG: #define __SPIR32__ 1
33 // CHECK-SPIR-NOT: #define __SPIR64__ 1
34
35 // RUN: %clang_cc1 %s -E -dM -o - -x cl -triple spir64-unknown-unknown \
36 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SPIR64
37 -// CHECK-SPIR64-DAG: #define __IMAGE_SUPPORT__ 1
38 // CHECK-SPIR64-DAG: #define __SPIR__ 1
39 // CHECK-SPIR64-DAG: #define __SPIR64__ 1
40 // CHECK-SPIR64-NOT: #define __SPIR32__ 1
41
42 // RUN: %clang_cc1 %s -E -dM -o - -x cl -triple spirv32-unknown-unknown \
43 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SPIRV32
44 -// CHECK-SPIRV32-DAG: #define __IMAGE_SUPPORT__ 1
45 // CHECK-SPIRV32-DAG: #define __SPIRV__ 1
46 // CHECK-SPIRV32-DAG: #define __SPIRV32__ 1
47 // CHECK-SPIRV32-NOT: #define __SPIRV64__ 1
48
49 // RUN: %clang_cc1 %s -E -dM -o - -x cl -triple spirv64-unknown-unknown \
50 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SPIRV64
51 -// CHECK-SPIRV64-DAG: #define __IMAGE_SUPPORT__ 1
52 // CHECK-SPIRV64-DAG: #define __SPIRV__ 1
53 // CHECK-SPIRV64-DAG: #define __SPIRV64__ 1
54 // CHECK-SPIRV64-NOT: #define __SPIRV32__ 1