Skip to content

Commit 5a7a324

Browse files
committed
[clang][NFC] Migrate bit-fields of OverloadCandidate to LLVM_PREFERRED_TYPE
1 parent 5139c90 commit 5a7a324

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

clang/include/clang/Sema/Overload.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,8 @@ class Sema;
898898
ConversionFixItGenerator Fix;
899899

900900
/// Viable - True to indicate that this overload candidate is viable.
901-
bool Viable : 1;
901+
LLVM_PREFERRED_TYPE(bool)
902+
unsigned Viable : 1;
902903

903904
/// Whether this candidate is the best viable function, or tied for being
904905
/// the best viable function.
@@ -907,12 +908,14 @@ class Sema;
907908
/// was part of the ambiguity kernel: the minimal non-empty set of viable
908909
/// candidates such that all elements of the ambiguity kernel are better
909910
/// than all viable candidates not in the ambiguity kernel.
910-
bool Best : 1;
911+
LLVM_PREFERRED_TYPE(bool)
912+
unsigned Best : 1;
911913

912914
/// IsSurrogate - True to indicate that this candidate is a
913915
/// surrogate for a conversion to a function pointer or reference
914916
/// (C++ [over.call.object]).
915-
bool IsSurrogate : 1;
917+
LLVM_PREFERRED_TYPE(bool)
918+
unsigned IsSurrogate : 1;
916919

917920
/// IgnoreObjectArgument - True to indicate that the first
918921
/// argument's conversion, which for this function represents the
@@ -921,12 +924,15 @@ class Sema;
921924
/// implicit object argument is just a placeholder) or a
922925
/// non-static member function when the call doesn't have an
923926
/// object argument.
924-
bool IgnoreObjectArgument : 1;
927+
LLVM_PREFERRED_TYPE(bool)
928+
unsigned IgnoreObjectArgument : 1;
925929

926-
bool TookAddressOfOverload : 1;
930+
LLVM_PREFERRED_TYPE(bool)
931+
unsigned TookAddressOfOverload : 1;
927932

928933
/// True if the candidate was found using ADL.
929-
CallExpr::ADLCallKind IsADLCandidate : 1;
934+
LLVM_PREFERRED_TYPE(CallExpr::ADLCallKind)
935+
unsigned IsADLCandidate : 1;
930936

931937
/// Whether this is a rewritten candidate, and if so, of what kind?
932938
LLVM_PREFERRED_TYPE(OverloadCandidateRewriteKind)
@@ -999,7 +1005,8 @@ class Sema;
9991005
friend class OverloadCandidateSet;
10001006
OverloadCandidate()
10011007
: IsSurrogate(false), IgnoreObjectArgument(false),
1002-
TookAddressOfOverload(false), IsADLCandidate(CallExpr::NotADL),
1008+
TookAddressOfOverload(false),
1009+
IsADLCandidate(llvm::to_underlying(CallExpr::NotADL)),
10031010
RewriteKind(CRK_None) {}
10041011
};
10051012

clang/lib/Sema/SemaOverload.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6977,7 +6977,7 @@ void Sema::AddOverloadCandidate(
69776977
Candidate.Viable = true;
69786978
Candidate.RewriteKind =
69796979
CandidateSet.getRewriteInfo().getRewriteKind(Function, PO);
6980-
Candidate.IsADLCandidate = IsADLCandidate;
6980+
Candidate.IsADLCandidate = llvm::to_underlying(IsADLCandidate);
69816981
Candidate.ExplicitCallArguments = Args.size();
69826982

69836983
// Explicit functions are not actually candidates at all if we're not
@@ -7832,7 +7832,7 @@ void Sema::AddTemplateOverloadCandidate(
78327832
Candidate.RewriteKind =
78337833
CandidateSet.getRewriteInfo().getRewriteKind(Candidate.Function, PO);
78347834
Candidate.IsSurrogate = false;
7835-
Candidate.IsADLCandidate = IsADLCandidate;
7835+
Candidate.IsADLCandidate = llvm::to_underlying(IsADLCandidate);
78367836
// Ignore the object argument if there is one, since we don't have an object
78377837
// type.
78387838
Candidate.IgnoreObjectArgument =
@@ -14082,7 +14082,8 @@ static ExprResult FinishOverloadedCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
1408214082
return ExprError();
1408314083
return SemaRef.BuildResolvedCallExpr(
1408414084
Res.get(), FDecl, LParenLoc, Args, RParenLoc, ExecConfig,
14085-
/*IsExecConfig=*/false, (*Best)->IsADLCandidate);
14085+
/*IsExecConfig=*/false,
14086+
static_cast<CallExpr::ADLCallKind>((*Best)->IsADLCandidate));
1408614087
}
1408714088

1408814089
case OR_No_Viable_Function: {
@@ -14156,7 +14157,8 @@ static ExprResult FinishOverloadedCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
1415614157
return ExprError();
1415714158
return SemaRef.BuildResolvedCallExpr(
1415814159
Res.get(), FDecl, LParenLoc, Args, RParenLoc, ExecConfig,
14159-
/*IsExecConfig=*/false, (*Best)->IsADLCandidate);
14160+
/*IsExecConfig=*/false,
14161+
static_cast<CallExpr::ADLCallKind>((*Best)->IsADLCandidate));
1416014162
}
1416114163
}
1416214164

@@ -14438,7 +14440,8 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
1443814440
Args[0] = Input;
1443914441
CallExpr *TheCall = CXXOperatorCallExpr::Create(
1444014442
Context, Op, FnExpr.get(), ArgsArray, ResultTy, VK, OpLoc,
14441-
CurFPFeatureOverrides(), Best->IsADLCandidate);
14443+
CurFPFeatureOverrides(),
14444+
static_cast<CallExpr::ADLCallKind>(Best->IsADLCandidate));
1444214445

1444314446
if (CheckCallReturnType(FnDecl->getReturnType(), OpLoc, TheCall, FnDecl))
1444414447
return ExprError();
@@ -14833,7 +14836,8 @@ ExprResult Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
1483314836
// members; CodeGen should take care not to emit the this pointer.
1483414837
TheCall = CXXOperatorCallExpr::Create(
1483514838
Context, ChosenOp, FnExpr.get(), Args, ResultTy, VK, OpLoc,
14836-
CurFPFeatureOverrides(), Best->IsADLCandidate);
14839+
CurFPFeatureOverrides(),
14840+
static_cast<CallExpr::ADLCallKind>(Best->IsADLCandidate));
1483714841

1483814842
if (const auto *Method = dyn_cast<CXXMethodDecl>(FnDecl);
1483914843
Method && Method->isImplicitObjectMemberFunction()) {

0 commit comments

Comments
 (0)