Skip to content

Commit 471e59b

Browse files
authored
[clang] Set correct CXXABI for UEFI (llvm#150115)
The target triple x86_64-uefi must be assumed to have Microsft ABI by default. Fixes: llvm#150113
1 parent 8c26858 commit 471e59b

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

clang/lib/Basic/TargetInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : Triple(T) {
172172
ComplexLongDoubleUsesFP2Ret = false;
173173

174174
// Set the C++ ABI based on the triple.
175-
TheCXXABI.set(Triple.isKnownWindowsMSVCEnvironment()
175+
TheCXXABI.set(Triple.isKnownWindowsMSVCEnvironment() || Triple.isUEFI()
176176
? TargetCXXABI::Microsoft
177177
: TargetCXXABI::GenericItanium);
178178

clang/test/Layout/ms-no-unique-address.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 -std=c++2a -fsyntax-only -triple x86_64-windows-msvc -fms-compatibility -fdump-record-layouts %s | FileCheck %s
2+
// RUN: %clang_cc1 -std=c++2a -fsyntax-only -triple x86_64-uefi -fms-compatibility -fdump-record-layouts %s | FileCheck %s
23

34
namespace Empty {
45
struct A {};

clang/test/SemaCXX/cxx2a-ms-no-unique-address.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %clang_cc1 -std=c++2a %s -verify=unsupported -triple x86_64-linux-gnu
22
// RUN: %clang_cc1 -std=c++2a %s -verify -triple x86_64-windows -fms-compatibility
3+
// RUN: %clang_cc1 -std=c++2a %s -verify -triple x86_64-uefi -fms-compatibility
34

45
[[msvc::no_unique_address]] int a; // expected-error {{only applies to non-bit-field non-static data members}} unsupported-warning {{unknown}}
56
[[msvc::no_unique_address]] void f(); // expected-error {{only applies to non-bit-field non-static data members}} unsupported-warning {{unknown}}

0 commit comments

Comments
 (0)