Skip to content

Commit b6606c2

Browse files
committed
Fix compiler errors from clang versions older than 15 not supporting gnu style attributes on namespaces
Fixes errors in GVN.h after changes in llvm#96630 to how LLVM_LIBRARY_VISIBILITY is defined
1 parent 7f77db4 commit b6606c2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/include/llvm/Support/Compiler.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,12 @@
130130

131131
#if (!(defined(_WIN32) || defined(__CYGWIN__)) || \
132132
(defined(__MINGW32__) && defined(__clang__)))
133+
// Clang compilers older then 15 do not support gnu style attributes on namespaces
134+
#if defined(__clang__) && _clang_major__ < 15
135+
#define LLVM_LIBRARY_VISIBILITY [[gnu::visibility("hidden")]]
136+
#else
133137
#define LLVM_LIBRARY_VISIBILITY LLVM_ATTRIBUTE_VISIBILITY_HIDDEN
138+
#endif
134139
#define LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
135140
#elif defined(_WIN32)
136141
#define LLVM_ALWAYS_EXPORT __declspec(dllexport)

0 commit comments

Comments
 (0)