@@ -4868,27 +4868,27 @@ static bool checkVAStartABI(Sema &S, unsigned BuiltinID, Expr *Fn) {
48684868 bool IsX64 = TT.getArch() == llvm::Triple::x86_64;
48694869 bool IsAArch64 = (TT.getArch() == llvm::Triple::aarch64 ||
48704870 TT.getArch() == llvm::Triple::aarch64_32);
4871- bool IsWindows = TT.isOSWindows();
4871+ bool IsWindowsOrUEFI = TT.isOSWindows() || TT.isUEFI ();
48724872 bool IsMSVAStart = BuiltinID == Builtin::BI__builtin_ms_va_start;
48734873 if (IsX64 || IsAArch64) {
48744874 CallingConv CC = CC_C;
48754875 if (const FunctionDecl *FD = S.getCurFunctionDecl())
48764876 CC = FD->getType()->castAs<FunctionType>()->getCallConv();
48774877 if (IsMSVAStart) {
48784878 // 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))
48804880 return S.Diag(Fn->getBeginLoc(),
48814881 diag::err_ms_va_start_used_in_sysv_function);
48824882 } else {
48834883 // On x86-64/AArch64 Unix, don't allow this in Win64 ABI functions.
48844884 // On x64 Windows, don't allow this in System V ABI functions.
48854885 // (Yes, that means there's no corresponding way to support variadic
48864886 // 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))
48894889 return S.Diag(Fn->getBeginLoc(),
48904890 diag::err_va_start_used_in_wrong_abi_function)
4891- << !IsWindows ;
4891+ << !IsWindowsOrUEFI ;
48924892 }
48934893 return false;
48944894 }
0 commit comments