@@ -4868,27 +4868,27 @@ static bool checkVAStartABI(Sema &S, unsigned BuiltinID, Expr *Fn) {
4868
4868
bool IsX64 = TT.getArch() == llvm::Triple::x86_64;
4869
4869
bool IsAArch64 = (TT.getArch() == llvm::Triple::aarch64 ||
4870
4870
TT.getArch() == llvm::Triple::aarch64_32);
4871
- bool IsWindows = TT.isOSWindows();
4871
+ bool IsWindowsOrUEFI = TT.isOSWindows() || TT.isUEFI ();
4872
4872
bool IsMSVAStart = BuiltinID == Builtin::BI__builtin_ms_va_start;
4873
4873
if (IsX64 || IsAArch64) {
4874
4874
CallingConv CC = CC_C;
4875
4875
if (const FunctionDecl *FD = S.getCurFunctionDecl())
4876
4876
CC = FD->getType()->castAs<FunctionType>()->getCallConv();
4877
4877
if (IsMSVAStart) {
4878
4878
// Don't allow this in System V ABI functions.
4879
- if (CC == CC_X86_64SysV || (!IsWindows && CC != CC_Win64))
4879
+ if (CC == CC_X86_64SysV || (!IsWindowsOrUEFI && CC != CC_Win64))
4880
4880
return S.Diag(Fn->getBeginLoc(),
4881
4881
diag::err_ms_va_start_used_in_sysv_function);
4882
4882
} else {
4883
4883
// On x86-64/AArch64 Unix, don't allow this in Win64 ABI functions.
4884
4884
// On x64 Windows, don't allow this in System V ABI functions.
4885
4885
// (Yes, that means there's no corresponding way to support variadic
4886
4886
// System V ABI functions on Windows.)
4887
- if ((IsWindows && CC == CC_X86_64SysV) ||
4888
- (!IsWindows && CC == CC_Win64))
4887
+ if ((IsWindowsOrUEFI && CC == CC_X86_64SysV) ||
4888
+ (!IsWindowsOrUEFI && CC == CC_Win64))
4889
4889
return S.Diag(Fn->getBeginLoc(),
4890
4890
diag::err_va_start_used_in_wrong_abi_function)
4891
- << !IsWindows ;
4891
+ << !IsWindowsOrUEFI ;
4892
4892
}
4893
4893
return false;
4894
4894
}
0 commit comments