Skip to content

Fix compiler errors in GVN.h for clang versions older than 15 #107636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions llvm/include/llvm/Support/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,22 @@
#if (!(defined(_WIN32) || defined(__CYGWIN__)) || \
(defined(__MINGW32__) && defined(__clang__)))
#define LLVM_LIBRARY_VISIBILITY LLVM_ATTRIBUTE_VISIBILITY_HIDDEN
// Clang compilers older then 15 do not support gnu style attributes on
// namespaces.
#if defined(__clang__) && __clang_major__ < 15
#define LLVM_LIBRARY_VISIBILITY_NAMESPACE [[gnu::visibility("hidden")]]
#else
#define LLVM_LIBRARY_VISIBILITY_NAMESPACE LLVM_ATTRIBUTE_VISIBILITY_HIDDEN
#endif
#define LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
#elif defined(_WIN32)
#define LLVM_ALWAYS_EXPORT __declspec(dllexport)
#define LLVM_LIBRARY_VISIBILITY
#define LLVM_LIBRARY_VISIBILITY_NAMESPACE
#else
#define LLVM_LIBRARY_VISIBILITY
#define LLVM_ALWAYS_EXPORT
#define LLVM_LIBRARY_VISIBILITY_NAMESPACE
#endif

/// LLVM_ABI is the main export/visibility macro to mark something as explicitly
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Transforms/Scalar/GVN.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class TargetLibraryInfo;
class Value;
/// A private "module" namespace for types and utilities used by GVN. These
/// are implementation details and should not be used by clients.
namespace LLVM_LIBRARY_VISIBILITY gvn {
namespace LLVM_LIBRARY_VISIBILITY_NAMESPACE gvn {

struct AvailableValue;
struct AvailableValueInBlock;
Expand Down
Loading