[clang] [llvm] [Support] Fix visibility macro guard: __WASM__ is never defined (PR #215665)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 11 13:59:17 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-support
Author: JohnnyAnliZ
<details>
<summary>Changes</summary>
The CLANG_ABI/LLVM_ABI visibility branches test defined __WASM__, but clang predefines lowercase __wasm__ for WebAssembly targets. __WASM__ doesn't exist, so this branch never fire for pure-WASI builds.
I hit this mismatch while building clang for wasm32-wasip1 with wasi-sdk.
---
Full diff: https://github.com/llvm/llvm-project/pull/215665.diff
2 Files Affected:
- (modified) clang/include/clang/Support/Compiler.h (+1-1)
- (modified) llvm/include/llvm/Support/Compiler.h (+1-1)
``````````diff
diff --git a/clang/include/clang/Support/Compiler.h b/clang/include/clang/Support/Compiler.h
index d7f7a0b092fbb..66d6c5b30e7b7 100644
--- a/clang/include/clang/Support/Compiler.h
+++ b/clang/include/clang/Support/Compiler.h
@@ -62,7 +62,7 @@
#define CLANG_ABI_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
#define CLANG_TEMPLATE_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
#define CLANG_EXPORT_TEMPLATE
-#elif defined(__MACH__) || defined(__WASM__) || defined(__EMSCRIPTEN__)
+#elif defined(__MACH__) || defined(__wasm__) || defined(__EMSCRIPTEN__)
#define CLANG_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
#define CLANG_ABI_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
#define CLANG_TEMPLATE_ABI
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h
index f9dc2e8d45c4d..33ea019a87be5 100644
--- a/llvm/include/llvm/Support/Compiler.h
+++ b/llvm/include/llvm/Support/Compiler.h
@@ -203,7 +203,7 @@
#define LLVM_TEMPLATE_ABI LLVM_ABI
#define LLVM_EXPORT_TEMPLATE
#define LLVM_ABI_EXPORT LLVM_ABI
-#elif defined(__MACH__) || defined(__WASM__) || defined(__EMSCRIPTEN__)
+#elif defined(__MACH__) || defined(__wasm__) || defined(__EMSCRIPTEN__)
#define LLVM_ABI __attribute__((visibility("default")))
#define LLVM_TEMPLATE_ABI
#define LLVM_EXPORT_TEMPLATE
``````````
</details>
https://github.com/llvm/llvm-project/pull/215665
More information about the cfe-commits
mailing list