Skip to content

Commit 2ad7a50

Browse files
committed
Make shouldUseMicrosoftCCforMangling generic to be used for ABI decisions beyond mangling.
1 parent f86a3dd commit 2ad7a50

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

clang/include/clang/Basic/TargetInfo.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ class TargetInfo : public TransferrableTargetInfo,
253253
const char *MCountName;
254254
unsigned char RegParmMax, SSERegParmMax;
255255
TargetCXXABI TheCXXABI;
256-
bool UseMicrosoftManglingForC = false;
256+
bool UseMicrosoftCCForC = false;
257257
const LangASMap *AddrSpaceMap;
258258

259259
mutable StringRef PlatformName;
@@ -1345,10 +1345,8 @@ class TargetInfo : public TransferrableTargetInfo,
13451345
return TheCXXABI;
13461346
}
13471347

1348-
/// Should the Microsoft mangling scheme be used for C Calling Convention.
1349-
bool shouldUseMicrosoftCCforMangling() const {
1350-
return UseMicrosoftManglingForC;
1351-
}
1348+
/// Should the Microsoft C Calling Convention be used.
1349+
bool shouldUseMicrosoftCCforC() const { return UseMicrosoftCCForC; }
13521350

13531351
/// Target the specified CPU.
13541352
///

clang/lib/AST/Mangle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static CCMangling getCallingConvMangling(const ASTContext &Context,
7474
if (FD->isMain() && FD->getNumParams() == 2)
7575
return CCM_WasmMainArgcArgv;
7676

77-
if (!TI.shouldUseMicrosoftCCforMangling())
77+
if (!TI.shouldUseMicrosoftCCforC())
7878
return CCM_Other;
7979

8080
if (Context.getLangOpts().CPlusPlus && !isExternC(ND) &&

clang/lib/Basic/Targets/OSTargets.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ class LLVM_LIBRARY_VISIBILITY UEFITargetInfo : public OSTargetInfo<Target> {
817817
: OSTargetInfo<Target>(Triple, Opts) {
818818
this->WCharType = TargetInfo::UnsignedShort;
819819
this->WIntType = TargetInfo::UnsignedShort;
820-
this->UseMicrosoftManglingForC = true;
820+
this->UseMicrosoftCCForC = true;
821821
}
822822
};
823823

@@ -838,7 +838,7 @@ class LLVM_LIBRARY_VISIBILITY WindowsTargetInfo : public OSTargetInfo<Target> {
838838
: OSTargetInfo<Target>(Triple, Opts) {
839839
this->WCharType = TargetInfo::UnsignedShort;
840840
this->WIntType = TargetInfo::UnsignedShort;
841-
this->UseMicrosoftManglingForC = true;
841+
this->UseMicrosoftCCForC = true;
842842
}
843843
};
844844

clang/lib/Sema/SemaChecking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4770,7 +4770,7 @@ ExprResult Sema::CheckOSLogFormatStringArg(Expr *Arg) {
47704770
/// target and calling convention.
47714771
static bool checkVAStartABI(Sema &S, unsigned BuiltinID, Expr *Fn) {
47724772
const TargetInfo &TI = S.Context.getTargetInfo();
4773-
bool IsMicrosoftCC = TI.shouldUseMicrosoftCCforMangling();
4773+
bool IsMicrosoftCC = TI.shouldUseMicrosoftCCforC();
47744774
const llvm::Triple &TT = TI.getTriple();
47754775
bool IsX64 = TT.getArch() == llvm::Triple::x86_64;
47764776
bool IsAArch64 = (TT.getArch() == llvm::Triple::aarch64 ||

clang/lib/Sema/SemaExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17990,7 +17990,7 @@ static bool isPotentiallyConstantEvaluatedContext(Sema &SemaRef) {
1799017990
static bool funcHasParameterSizeMangling(Sema &S, FunctionDecl *FD) {
1799117991
// These manglings are only applicable for targets whcih use Microsoft
1799217992
// mangling scheme for C.
17993-
if (!S.Context.getTargetInfo().shouldUseMicrosoftCCforMangling())
17993+
if (!S.Context.getTargetInfo().shouldUseMicrosoftCCforC())
1799417994
return false;
1799517995

1799617996
// If this is C++ and this isn't an extern "C" function, parameters do not

0 commit comments

Comments
 (0)