Skip to content

Commit 3d62cf0

Browse files
committed
[llvm] check for visibility attribute
1 parent c57be05 commit 3d62cf0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

llvm/include/llvm/Support/Compiler.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@
197197
#define LLVM_EXPORT_TEMPLATE
198198
#endif
199199
#define LLVM_ABI_EXPORT __declspec(dllexport)
200-
#elif defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) || \
201-
defined(__MVS__)
200+
#elif (defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) || \
201+
defined(__MVS__)) && __has_attribute(visibililty)
202202
#define LLVM_ABI __attribute__((visibility("default")))
203203
#if defined(__GNUC__) && !defined(__clang__)
204204
// GCC produces warnings on visibility attributes applied to templates.
@@ -208,11 +208,17 @@
208208
#endif
209209
#define LLVM_EXPORT_TEMPLATE
210210
#define LLVM_ABI_EXPORT __attribute__((visibility("default")))
211-
#elif defined(__MACH__) || defined(__WASM__) || defined(__EMSCRIPTEN__)
211+
#elif (defined(__MACH__) || defined(__WASM__) || defined(__EMSCRIPTEN__)) && \
212+
__has_attribute(visibility)
212213
#define LLVM_ABI __attribute__((visibility("default")))
213214
#define LLVM_TEMPLATE_ABI
214215
#define LLVM_EXPORT_TEMPLATE
215216
#define LLVM_ABI_EXPORT __attribute__((visibility("default")))
217+
#else
218+
#define LLVM_ABI
219+
#define LLVM_TEMPLATE_ABI
220+
#define LLVM_EXPORT_TEMPLATE
221+
#define LLVM_ABI_EXPORT
216222
#endif
217223
#else
218224
#define LLVM_ABI

0 commit comments

Comments
 (0)