[clang] Reland "[Modules] Fix using `va_list` with modules and a precompiled header. (#101752)" (PR #101762)

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 11:41:27 PDT 2024


================
@@ -0,0 +1,84 @@
+// Check how builtins using varargs behave with the modules.
+
+// REQUIRES: x86-registered-target
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin \
----------------
vsapsai wrote:

The issue is reproducible on x86_64 and not on arm64 because triggering it requires `__builtin_va_list` to be defined as `__va_list_tag[1]` and that happens in `CreateX86_64ABIBuiltinVaListDecl` (for more options see https://github.com/llvm/llvm-project/blob/a3ccaed3b9f6a1fe9b7f2ef019259f88072639b2/clang/lib/AST/ASTContext.cpp#L9587-L9604

I agree the test can be useful for multiple architectures but the default target won't catch the issue reliably for Apple platforms. We can try to make clang stricter and discover similar issues by adding an assertion in `ASTContext::getBuiltinVaListDecl`, so that might be a good option for other platforms.

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


More information about the cfe-commits mailing list