[clang] [WebAssembly] Enable musttail only when tail-call is enabled (PR #163618)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 23 06:24:12 PDT 2025


================
@@ -672,6 +672,12 @@ static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const ParsedAttr &A,
       !(A.existsInTarget(S.Context.getTargetInfo()) ||
         (S.Context.getLangOpts().SYCLIsDevice && Aux &&
          A.existsInTarget(*Aux)))) {
+    // Special case: musttail on WebAssembly without tail-call feature
+    if (A.getKind() == ParsedAttr::AT_MustTail &&
+        !S.Context.getTargetInfo().hasMustTail()) {
+      S.Diag(A.getLoc(), diag::err_wasm_musttail_unsupported);
+      return nullptr;
+    }
----------------
AaronBallman wrote:

You shouldn't need to add this code, either `existsInTarget()` (slightly above) will catch it, or `checkCommonAttributeFeatures()` (slightly below) will.

https://github.com/llvm/llvm-project/pull/163618


More information about the cfe-commits mailing list