diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h index e1d54af7dfcce1..0452f88cbf2c66 100644 --- a/llvm/include/llvm/Support/Compiler.h +++ b/llvm/include/llvm/Support/Compiler.h @@ -130,7 +130,12 @@ #if (!(defined(_WIN32) || defined(__CYGWIN__)) || \ (defined(__MINGW32__) && defined(__clang__))) +// Clang compilers older then 15 do not support gnu style attributes on namespaces +#if defined(__clang__) && _clang_major__ < 15 +#define LLVM_LIBRARY_VISIBILITY [[gnu::visibility("hidden")]] +#else #define LLVM_LIBRARY_VISIBILITY LLVM_ATTRIBUTE_VISIBILITY_HIDDEN +#endif #define LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT #elif defined(_WIN32) #define LLVM_ALWAYS_EXPORT __declspec(dllexport)