Skip to content

Commit 2be2cd4

Browse files
committed
[llvm] always define LLVM_ABI using __attribute__
1 parent b0378e7 commit 2be2cd4

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

llvm/include/llvm/Support/Compiler.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,19 +208,25 @@
208208
#endif
209209
#define LLVM_ABI_FRIEND LLVM_ABI
210210
#define LLVM_ABI_EXPORT __declspec(dllexport)
211-
#elif defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) || \
212-
defined(__MVS__) || defined(__CYGWIN__)
213-
#define LLVM_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
211+
#elif __has_attribute(visibility)
212+
#define LLVM_ABI __attribute__((visibility("default")))
213+
#if defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) || \
214+
defined(__MVS__)
214215
#define LLVM_ABI_FRIEND
215-
#define LLVM_TEMPLATE_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
216+
#define LLVM_TEMPLATE_ABI LLVM_ABI
216217
#define LLVM_EXPORT_TEMPLATE
217-
#define LLVM_ABI_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
218+
#define LLVM_ABI_EXPORT LLVM_ABI
218219
#elif defined(__MACH__) || defined(__WASM__) || defined(__EMSCRIPTEN__)
219-
#define LLVM_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
220220
#define LLVM_ABI_FRIEND
221221
#define LLVM_TEMPLATE_ABI
222222
#define LLVM_EXPORT_TEMPLATE
223-
#define LLVM_ABI_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
223+
#define LLVM_ABI_EXPORT LLVM_ABI
224+
#else
225+
#define LLVM_ABI
226+
#define LLVM_ABI_FRIEND
227+
#define LLVM_TEMPLATE_ABI
228+
#define LLVM_EXPORT_TEMPLATE
229+
#define LLVM_ABI_EXPORT
224230
#endif
225231
#else
226232
#define LLVM_ABI
@@ -229,6 +235,7 @@
229235
#define LLVM_EXPORT_TEMPLATE
230236
#define LLVM_ABI_EXPORT
231237
#endif
238+
#endif
232239
#define LLVM_C_ABI LLVM_ABI
233240
#endif
234241

0 commit comments

Comments
 (0)