[all-commits] [llvm/llvm-project] beea2a: [Clang] Respect MS layout attributes during CUDA/H...
Yaxun (Sam) Liu via All-commits
all-commits at lists.llvm.org
Wed Jul 9 05:53:32 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: beea2a941470368a87b1816e455b1db366c1bbb9
https://github.com/llvm/llvm-project/commit/beea2a941470368a87b1816e455b1db366c1bbb9
Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
Date: 2025-07-09 (Wed, 09 Jul 2025)
Changed paths:
M clang/include/clang/Basic/Attr.td
M clang/include/clang/Basic/TargetInfo.h
M clang/lib/AST/RecordLayoutBuilder.cpp
M clang/lib/Basic/TargetInfo.cpp
M clang/lib/Basic/Targets/AMDGPU.cpp
M clang/lib/Basic/Targets/AMDGPU.h
M clang/lib/Basic/Targets/DirectX.h
M clang/lib/Basic/Targets/PPC.cpp
M clang/lib/Basic/Targets/PPC.h
M clang/lib/Basic/Targets/SPIR.h
M clang/lib/Basic/Targets/WebAssembly.cpp
M clang/lib/Basic/Targets/WebAssembly.h
M clang/lib/Basic/Targets/X86.h
M clang/lib/Frontend/ASTUnit.cpp
M clang/lib/Frontend/CompilerInstance.cpp
M clang/lib/Interpreter/Interpreter.cpp
M clang/test/Layout/ms-x86-declspec-empty_bases.cpp
M clang/test/SemaCXX/ms-layout_version.cpp
M clang/tools/clang-import-test/clang-import-test.cpp
Log Message:
-----------
[Clang] Respect MS layout attributes during CUDA/HIP device compilation (#146620)
This patch fixes an issue where Microsoft-specific layout attributes,
such as __declspec(empty_bases), were ignored during CUDA/HIP device
compilation on a Windows host. This caused a critical memory layout
mismatch between host and device objects, breaking libraries that rely
on these attributes for ABI compatibility.
The fix introduces a centralized hasMicrosoftRecordLayout() check within
the TargetInfo class. This check is aware of the auxiliary (host) target
and is set during TargetInfo::adjust if the host uses a Microsoft ABI.
The empty_bases, layout_version, and msvc::no_unique_address attributes
now use this centralized flag, ensuring device code respects them and
maintains layout consistency with the host.
Fixes: https://github.com/llvm/llvm-project/issues/146047
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list