Author: Vlad Serebrennikov
Date: 2025-05-01T07:01:06+03:00
New Revision: c2c0ef50a1a679058fffe445a6e78b6d232dc231

URL: 
https://github.com/llvm/llvm-project/commit/c2c0ef50a1a679058fffe445a6e78b6d232dc231
DIFF: 
https://github.com/llvm/llvm-project/commit/c2c0ef50a1a679058fffe445a6e78b6d232dc231.diff

LOG: [clang][NFC] Convert `Sema::VariadicCallType` to scoped enum

Added: 
    

Modified: 
    clang/include/clang/Sema/Sema.h
    clang/lib/Sema/SemaChecking.cpp
    clang/lib/Sema/SemaDeclCXX.cpp
    clang/lib/Sema/SemaExpr.cpp
    clang/lib/Sema/SemaExprCXX.cpp
    clang/lib/Sema/SemaExprObjC.cpp
    clang/lib/Sema/SemaObjC.cpp
    clang/lib/Sema/SemaOverload.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 2c203e1ba4305..5ffb9b414e9e0 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -510,6 +510,15 @@ enum class FormatStringType {
   Unknown
 };
 
+// Used for emitting the right warning by DefaultVariadicArgumentPromotion
+enum class VariadicCallType {
+  Function,
+  Block,
+  Method,
+  Constructor,
+  DoesNotApply
+};
+
 /// Sema - This implements semantic analysis and AST building for C.
 /// \nosubgrouping
 class Sema final : public SemaBase {
@@ -2381,15 +2390,6 @@ class Sema final : public SemaBase {
   void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr,
                         SourceLocation OpLoc);
 
-  // Used for emitting the right warning by DefaultVariadicArgumentPromotion
-  enum VariadicCallType {
-    VariadicFunction,
-    VariadicBlock,
-    VariadicMethod,
-    VariadicConstructor,
-    VariadicDoesNotApply
-  };
-
   bool IsLayoutCompatible(QualType T1, QualType T2) const;
   bool IsPointerInterconvertibleBaseOf(const TypeSourceInfo *Base,
                                        const TypeSourceInfo *Derived);
@@ -7739,13 +7739,12 @@ class Sema final : public SemaBase {
 
   /// GatherArgumentsForCall - Collector argument expressions for various
   /// form of call prototypes.
-  bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl,
-                              const FunctionProtoType *Proto,
-                              unsigned FirstParam, ArrayRef<Expr *> Args,
-                              SmallVectorImpl<Expr *> &AllArgs,
-                              VariadicCallType CallType = VariadicDoesNotApply,
-                              bool AllowExplicit = false,
-                              bool IsListInitialization = false);
+  bool GatherArgumentsForCall(
+      SourceLocation CallLoc, FunctionDecl *FDecl,
+      const FunctionProtoType *Proto, unsigned FirstParam,
+      ArrayRef<Expr *> Args, SmallVectorImpl<Expr *> &AllArgs,
+      VariadicCallType CallType = VariadicCallType::DoesNotApply,
+      bool AllowExplicit = false, bool IsListInitialization = false);
 
   // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but
   // will create a runtime trap if the resulting type is not a POD type.

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index d2cad8a6fd608..f1b9f5419f44e 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -82,6 +82,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/STLForwardCompat.h"
 #include "llvm/ADT/SmallBitVector.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallString.h"
@@ -3345,7 +3346,7 @@ void Sema::checkCall(NamedDecl *FDecl, const 
FunctionProtoType *Proto,
   // Refuse POD arguments that weren't caught by the format string
   // checks above.
   auto *FD = dyn_cast_or_null<FunctionDecl>(FDecl);
-  if (CallType != VariadicDoesNotApply &&
+  if (CallType != VariadicCallType::DoesNotApply &&
       (!FD || FD->getBuiltinID() != Builtin::BI__noop)) {
     unsigned NumParams = Proto ? Proto->getNumParams()
                          : isa_and_nonnull<FunctionDecl>(FDecl)
@@ -3396,7 +3397,7 @@ void Sema::checkCall(NamedDecl *FDecl, const 
FunctionProtoType *Proto,
         if (Context.getTargetInfo().getTriple().isOSAIX() && FDecl && Arg &&
             FDecl->hasLinkage() &&
             FDecl->getFormalLinkage() != Linkage::Internal &&
-            CallType == VariadicDoesNotApply)
+            CallType == VariadicCallType::DoesNotApply)
           PPC().checkAIXMemberAlignment((Arg->getExprLoc()), Arg);
 
         QualType ParamTy = Proto->getParamType(ArgIdx);
@@ -3518,8 +3519,9 @@ void Sema::CheckConstructorCall(FunctionDecl *FDecl, 
QualType ThisType,
                                 ArrayRef<const Expr *> Args,
                                 const FunctionProtoType *Proto,
                                 SourceLocation Loc) {
-  VariadicCallType CallType =
-      Proto->isVariadic() ? VariadicConstructor : VariadicDoesNotApply;
+  VariadicCallType CallType = Proto->isVariadic()
+                                  ? VariadicCallType::Constructor
+                                  : VariadicCallType::DoesNotApply;
 
   auto *Ctor = cast<CXXConstructorDecl>(FDecl);
   CheckArgAlignment(
@@ -3630,11 +3632,11 @@ bool Sema::CheckPointerCall(NamedDecl *NDecl, CallExpr 
*TheCall,
 
   VariadicCallType CallType;
   if (!Proto || !Proto->isVariadic()) {
-    CallType = VariadicDoesNotApply;
+    CallType = VariadicCallType::DoesNotApply;
   } else if (Ty->isBlockPointerType()) {
-    CallType = VariadicBlock;
+    CallType = VariadicCallType::Block;
   } else { // Ty->isFunctionPointerType()
-    CallType = VariadicFunction;
+    CallType = VariadicCallType::Function;
   }
 
   checkCall(NDecl, Proto, /*ThisArg=*/nullptr,
@@ -5527,7 +5529,7 @@ bool Sema::BuiltinOSLogFormat(CallExpr *TheCall) {
   unsigned FirstDataArg = i;
   while (i < NumArgs) {
     ExprResult Arg = DefaultVariadicArgumentPromotion(
-        TheCall->getArg(i), VariadicFunction, nullptr);
+        TheCall->getArg(i), VariadicCallType::Function, nullptr);
     if (Arg.isInvalid())
       return true;
     CharUnits ArgSize = Context.getTypeSizeInChars(Arg.get()->getType());
@@ -5547,8 +5549,8 @@ bool Sema::BuiltinOSLogFormat(CallExpr *TheCall) {
     ArrayRef<const Expr *> Args(TheCall->getArgs(), TheCall->getNumArgs());
     bool Success = CheckFormatArguments(
         Args, FAPK_Variadic, nullptr, FormatIdx, FirstDataArg,
-        FormatStringType::OSLog, VariadicFunction, TheCall->getBeginLoc(),
-        SourceRange(), CheckedVarArgs);
+        FormatStringType::OSLog, VariadicCallType::Function,
+        TheCall->getBeginLoc(), SourceRange(), CheckedVarArgs);
     if (!Success)
       return true;
   }
@@ -5990,7 +5992,7 @@ static void CheckFormatString(
     const StringLiteral *ReferenceFormatString, const Expr *OrigFormatExpr,
     ArrayRef<const Expr *> Args, Sema::FormatArgumentPassingKind APK,
     unsigned format_idx, unsigned firstDataArg, FormatStringType Type,
-    bool inFunctionCall, Sema::VariadicCallType CallType,
+    bool inFunctionCall, VariadicCallType CallType,
     llvm::SmallBitVector &CheckedVarArgs, UncoveredArgHandler &UncoveredArg,
     bool IgnoreStringsWithoutSpecifiers);
 
@@ -6005,7 +6007,7 @@ static StringLiteralCheckType checkFormatStringExpr(
     Sema &S, const StringLiteral *ReferenceFormatString, const Expr *E,
     ArrayRef<const Expr *> Args, Sema::FormatArgumentPassingKind APK,
     unsigned format_idx, unsigned firstDataArg, FormatStringType Type,
-    Sema::VariadicCallType CallType, bool InFunctionCall,
+    VariadicCallType CallType, bool InFunctionCall,
     llvm::SmallBitVector &CheckedVarArgs, UncoveredArgHandler &UncoveredArg,
     llvm::APSInt Offset, bool IgnoreStringsWithoutSpecifiers = false) {
   if (S.isConstantEvaluatedContext())
@@ -6465,7 +6467,8 @@ bool Sema::CheckFormatArguments(const FormatAttr *Format,
                                 llvm::SmallBitVector &CheckedVarArgs) {
   FormatStringInfo FSI;
   if (getFormatStringInfo(Format->getFormatIdx(), Format->getFirstArg(),
-                          IsCXXMember, CallType != VariadicDoesNotApply, &FSI))
+                          IsCXXMember,
+                          CallType != VariadicCallType::DoesNotApply, &FSI))
     return CheckFormatArguments(
         Args, FSI.ArgPassingKind, nullptr, FSI.FormatIdx, FSI.FirstDataArg,
         GetFormatStringType(Format), CallType, Loc, Range, CheckedVarArgs);
@@ -6594,7 +6597,7 @@ class CheckFormatHandler : public 
analyze_format_string::FormatStringHandler {
   bool usesPositionalArgs = false;
   bool atFirstArg = true;
   bool inFunctionCall;
-  Sema::VariadicCallType CallType;
+  VariadicCallType CallType;
   llvm::SmallBitVector &CheckedVarArgs;
   UncoveredArgHandler &UncoveredArg;
 
@@ -6604,7 +6607,7 @@ class CheckFormatHandler : public 
analyze_format_string::FormatStringHandler {
                      unsigned firstDataArg, unsigned numDataArgs,
                      const char *beg, Sema::FormatArgumentPassingKind APK,
                      ArrayRef<const Expr *> Args, unsigned formatIdx,
-                     bool inFunctionCall, Sema::VariadicCallType callType,
+                     bool inFunctionCall, VariadicCallType callType,
                      llvm::SmallBitVector &CheckedVarArgs,
                      UncoveredArgHandler &UncoveredArg)
       : S(s), FExpr(fexpr), OrigFormatExpr(origFormatExpr), FSType(type),
@@ -7052,7 +7055,7 @@ class CheckPrintfHandler : public CheckFormatHandler {
                      unsigned firstDataArg, unsigned numDataArgs, bool isObjC,
                      const char *beg, Sema::FormatArgumentPassingKind APK,
                      ArrayRef<const Expr *> Args, unsigned formatIdx,
-                     bool inFunctionCall, Sema::VariadicCallType CallType,
+                     bool inFunctionCall, VariadicCallType CallType,
                      llvm::SmallBitVector &CheckedVarArgs,
                      UncoveredArgHandler &UncoveredArg)
       : CheckFormatHandler(s, fexpr, origFormatExpr, type, firstDataArg,
@@ -7187,7 +7190,7 @@ class DecomposePrintfHandler : public CheckPrintfHandler {
                          unsigned numDataArgs, bool isObjC, const char *beg,
                          Sema::FormatArgumentPassingKind APK,
                          ArrayRef<const Expr *> Args, unsigned formatIdx,
-                         bool inFunctionCall, Sema::VariadicCallType CallType,
+                         bool inFunctionCall, VariadicCallType CallType,
                          llvm::SmallBitVector &CheckedVarArgs,
                          UncoveredArgHandler &UncoveredArg,
                          llvm::SmallVectorImpl<EquatableFormatArgument> &Specs)
@@ -7461,8 +7464,8 @@ bool DecomposePrintfHandler::GetSpecifiers(
   const Expr *PrintfArgs[] = {FSL->getFormatString()};
   DecomposePrintfHandler H(S, FSL, FSL->getFormatString(), Type, 0, 0, IsObjC,
                            Str, Sema::FAPK_Elsewhere, PrintfArgs, 0,
-                           InFunctionCall, Sema::VariadicDoesNotApply, BV, UA,
-                           Args);
+                           InFunctionCall, VariadicCallType::DoesNotApply, BV,
+                           UA, Args);
 
   if (!analyze_format_string::ParsePrintfString(
           H, Str, Str + Data.size(), S.getLangOpts(), 
S.Context.getTargetInfo(),
@@ -8331,12 +8334,13 @@ CheckPrintfHandler::checkFormatExpr(const 
analyze_printf::PrintfSpecifier &FS,
     }
     case Sema::VAK_Undefined:
     case Sema::VAK_MSVCUndefined:
-      if (CallType == Sema::VariadicDoesNotApply) {
+      if (CallType == VariadicCallType::DoesNotApply) {
         EmitTypeMismatch = true;
       } else {
         EmitFormatDiagnostic(
             S.PDiag(diag::warn_non_pod_vararg_with_format_string)
-                << S.getLangOpts().CPlusPlus11 << ExprTy << CallType
+                << S.getLangOpts().CPlusPlus11 << ExprTy
+                << llvm::to_underlying(CallType)
                 << AT.getRepresentativeTypeName(S.Context) << CSR
                 << E->getSourceRange(),
             E->getBeginLoc(), /*IsStringLocation*/ false, CSR);
@@ -8345,12 +8349,13 @@ CheckPrintfHandler::checkFormatExpr(const 
analyze_printf::PrintfSpecifier &FS,
       break;
 
     case Sema::VAK_Invalid:
-      if (CallType == Sema::VariadicDoesNotApply)
+      if (CallType == VariadicCallType::DoesNotApply)
         EmitTypeMismatch = true;
       else if (ExprTy->isObjCObjectType())
         EmitFormatDiagnostic(
             S.PDiag(diag::err_cannot_pass_objc_interface_to_vararg_format)
-                << S.getLangOpts().CPlusPlus11 << ExprTy << CallType
+                << S.getLangOpts().CPlusPlus11 << ExprTy
+                << llvm::to_underlying(CallType)
                 << AT.getRepresentativeTypeName(S.Context) << CSR
                 << E->getSourceRange(),
             E->getBeginLoc(), /*IsStringLocation*/ false, CSR);
@@ -8358,7 +8363,7 @@ CheckPrintfHandler::checkFormatExpr(const 
analyze_printf::PrintfSpecifier &FS,
         // FIXME: If this is an initializer list, suggest removing the braces
         // or inserting a cast to the target type.
         S.Diag(E->getBeginLoc(), diag::err_cannot_pass_to_vararg_format)
-            << isa<InitListExpr>(E) << ExprTy << CallType
+            << isa<InitListExpr>(E) << ExprTy << llvm::to_underlying(CallType)
             << AT.getRepresentativeTypeName(S.Context) << E->getSourceRange();
       break;
     }
@@ -8395,7 +8400,7 @@ class CheckScanfHandler : public CheckFormatHandler {
                     unsigned firstDataArg, unsigned numDataArgs,
                     const char *beg, Sema::FormatArgumentPassingKind APK,
                     ArrayRef<const Expr *> Args, unsigned formatIdx,
-                    bool inFunctionCall, Sema::VariadicCallType CallType,
+                    bool inFunctionCall, VariadicCallType CallType,
                     llvm::SmallBitVector &CheckedVarArgs,
                     UncoveredArgHandler &UncoveredArg)
       : CheckFormatHandler(s, fexpr, origFormatExpr, type, firstDataArg,
@@ -8624,7 +8629,7 @@ static void CheckFormatString(
     const StringLiteral *ReferenceFormatString, const Expr *OrigFormatExpr,
     ArrayRef<const Expr *> Args, Sema::FormatArgumentPassingKind APK,
     unsigned format_idx, unsigned firstDataArg, FormatStringType Type,
-    bool inFunctionCall, Sema::VariadicCallType CallType,
+    bool inFunctionCall, VariadicCallType CallType,
     llvm::SmallBitVector &CheckedVarArgs, UncoveredArgHandler &UncoveredArg,
     bool IgnoreStringsWithoutSpecifiers) {
   // CHECK: is the format string a wide literal?

diff  --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 6bf2dea3c75df..645a0887c0f19 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -16425,8 +16425,9 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl 
*Constructor,
   else
     ConvertedArgs.reserve(NumArgs);
 
-  VariadicCallType CallType =
-    Proto->isVariadic() ? VariadicConstructor : VariadicDoesNotApply;
+  VariadicCallType CallType = Proto->isVariadic()
+                                  ? VariadicCallType::Constructor
+                                  : VariadicCallType::DoesNotApply;
   SmallVector<Expr *, 8> AllArgs;
   bool Invalid = GatherArgumentsForCall(
       Loc, Constructor, Proto, 0, llvm::ArrayRef(Args, NumArgs), AllArgs,

diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 283d910a09d54..9c8e7e9cabb33 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1022,7 +1022,8 @@ void Sema::checkVariadicArgument(const Expr *E, 
VariadicCallType CT) {
   case VAK_ValidInCXX11:
     DiagRuntimeBehavior(
         E->getBeginLoc(), nullptr,
-        PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg) << Ty << CT);
+        PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg)
+            << Ty << llvm::to_underlying(CT));
     [[fallthrough]];
   case VAK_Valid:
     if (Ty->isRecordType()) {
@@ -1030,7 +1031,8 @@ void Sema::checkVariadicArgument(const Expr *E, 
VariadicCallType CT) {
       // 'c_str' member function, the user probably meant to call that.
       DiagRuntimeBehavior(E->getBeginLoc(), nullptr,
                           PDiag(diag::warn_pass_class_arg_to_vararg)
-                              << Ty << CT << hasCStrMethod(E) << ".c_str()");
+                              << Ty << llvm::to_underlying(CT)
+                              << hasCStrMethod(E) << ".c_str()");
     }
     break;
 
@@ -1038,21 +1040,22 @@ void Sema::checkVariadicArgument(const Expr *E, 
VariadicCallType CT) {
   case VAK_MSVCUndefined:
     DiagRuntimeBehavior(E->getBeginLoc(), nullptr,
                         PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
-                            << getLangOpts().CPlusPlus11 << Ty << CT);
+                            << getLangOpts().CPlusPlus11 << Ty
+                            << llvm::to_underlying(CT));
     break;
 
   case VAK_Invalid:
     if (Ty.isDestructedType() == QualType::DK_nontrivial_c_struct)
       Diag(E->getBeginLoc(),
            diag::err_cannot_pass_non_trivial_c_struct_to_vararg)
-          << Ty << CT;
+          << Ty << llvm::to_underlying(CT);
     else if (Ty->isObjCObjectType())
       DiagRuntimeBehavior(E->getBeginLoc(), nullptr,
                           PDiag(diag::err_cannot_pass_objc_interface_to_vararg)
-                              << Ty << CT);
+                              << Ty << llvm::to_underlying(CT));
     else
       Diag(E->getBeginLoc(), diag::err_cannot_pass_to_vararg)
-          << isa<InitListExpr>(E) << Ty << CT;
+          << isa<InitListExpr>(E) << Ty << llvm::to_underlying(CT);
     break;
   }
 }
@@ -1062,7 +1065,7 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr 
*E, VariadicCallType CT,
   if (const BuiltinType *PlaceholderTy = E->getType()->getAsPlaceholderType()) 
{
     // Strip the unbridged-cast placeholder expression off, if applicable.
     if (PlaceholderTy->getKind() == BuiltinType::ARCUnbridgedCast &&
-        (CT == VariadicMethod ||
+        (CT == VariadicCallType::Method ||
          (FDecl && FDecl->hasAttr<CFAuditedTransferAttr>()))) {
       E = ObjC().stripARCUnbridgedCast(E);
 
@@ -5772,23 +5775,23 @@ ExprResult Sema::BuildCXXDefaultInitExpr(SourceLocation 
Loc, FieldDecl *Field) {
   return ExprError();
 }
 
-Sema::VariadicCallType
-Sema::getVariadicCallType(FunctionDecl *FDecl, const FunctionProtoType *Proto,
-                          Expr *Fn) {
+VariadicCallType Sema::getVariadicCallType(FunctionDecl *FDecl,
+                                           const FunctionProtoType *Proto,
+                                           Expr *Fn) {
   if (Proto && Proto->isVariadic()) {
     if (isa_and_nonnull<CXXConstructorDecl>(FDecl))
-      return VariadicConstructor;
+      return VariadicCallType::Constructor;
     else if (Fn && Fn->getType()->isBlockPointerType())
-      return VariadicBlock;
+      return VariadicCallType::Block;
     else if (FDecl) {
       if (CXXMethodDecl *Method = dyn_cast_or_null<CXXMethodDecl>(FDecl))
         if (Method->isInstance())
-          return VariadicMethod;
+          return VariadicCallType::Method;
     } else if (Fn && Fn->getType() == Context.BoundMemberTy)
-      return VariadicMethod;
-    return VariadicFunction;
+      return VariadicCallType::Method;
+    return VariadicCallType::Function;
   }
-  return VariadicDoesNotApply;
+  return VariadicCallType::DoesNotApply;
 }
 
 namespace {
@@ -6099,7 +6102,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, 
FunctionDecl *FDecl,
   }
 
   // If this is a variadic call, handle args passed through "...".
-  if (CallType != VariadicDoesNotApply) {
+  if (CallType != VariadicCallType::DoesNotApply) {
     // Assume that extern "C" functions with variadic arguments that
     // return __unknown_anytype aren't *really* variadic.
     if (Proto->getReturnType() == Context.UnknownAnyTy && FDecl &&

diff  --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 73be4080ff90f..727eefa6ce7a4 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -2452,8 +2452,9 @@ ExprResult Sema::BuildCXXNew(SourceRange Range, bool 
UseGlobal,
   SmallVector<Expr *, 8> AllPlaceArgs;
   if (OperatorNew) {
     auto *Proto = OperatorNew->getType()->castAs<FunctionProtoType>();
-    VariadicCallType CallType = Proto->isVariadic() ? VariadicFunction
-                                                    : VariadicDoesNotApply;
+    VariadicCallType CallType = Proto->isVariadic()
+                                    ? VariadicCallType::Function
+                                    : VariadicCallType::DoesNotApply;
 
     // We've already converted the placement args, just fill in any default
     // arguments. Skip the first parameter because we don't have a 
corresponding

diff  --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index f731f9c198535..a148759ed52b7 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -1894,7 +1894,7 @@ bool SemaObjC::CheckMessageArgumentTypes(
         continue;
 
       ExprResult Arg = SemaRef.DefaultVariadicArgumentPromotion(
-          Args[i], Sema::VariadicMethod, nullptr);
+          Args[i], VariadicCallType::Method, nullptr);
       IsError |= Arg.isInvalid();
       Args[i] = Arg.get();
     }

diff  --git a/clang/lib/Sema/SemaObjC.cpp b/clang/lib/Sema/SemaObjC.cpp
index 02fdac5122c28..184f67ec270a5 100644
--- a/clang/lib/Sema/SemaObjC.cpp
+++ b/clang/lib/Sema/SemaObjC.cpp
@@ -1245,8 +1245,9 @@ bool SemaObjC::CheckObjCString(Expr *Arg) {
 
 bool SemaObjC::CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation 
lbrac,
                                    ArrayRef<const Expr *> Args) {
-  Sema::VariadicCallType CallType =
-      Method->isVariadic() ? Sema::VariadicMethod : Sema::VariadicDoesNotApply;
+  VariadicCallType CallType = Method->isVariadic()
+                                  ? VariadicCallType::Method
+                                  : VariadicCallType::DoesNotApply;
 
   SemaRef.checkCall(Method, nullptr, /*ThisArg=*/nullptr, Args,
                     /*IsMemberFunction=*/false, lbrac, 
Method->getSourceRange(),

diff  --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 9c8f7bef35e4c..b8c2356aac3fd 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -7313,8 +7313,8 @@ Sema::SelectBestMethod(Selector Sel, MultiExprArg Args, 
bool IsInstance,
           Match = false;
           break;
         }
-        ExprResult Arg = DefaultVariadicArgumentPromotion(Args[i], 
VariadicMethod,
-                                                          nullptr);
+        ExprResult Arg = DefaultVariadicArgumentPromotion(
+            Args[i], VariadicCallType::Method, nullptr);
         if (Arg.isInvalid()) {
           Match = false;
           break;
@@ -15387,7 +15387,7 @@ ExprResult Sema::CreateOverloadedBinOp(SourceLocation 
OpLoc,
 
         checkCall(FnDecl, nullptr, ImplicitThis, ArgsArray,
                   isa<CXXMethodDecl>(FnDecl), OpLoc, TheCall->getSourceRange(),
-                  VariadicDoesNotApply);
+                  VariadicCallType::DoesNotApply);
 
         ExprResult R = MaybeBindToTemporary(TheCall);
         if (R.isInvalid())
@@ -16451,8 +16451,8 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
   if (Proto->isVariadic()) {
     // Promote the arguments (C99 6.5.2.2p7).
     for (unsigned i = NumParams, e = Args.size(); i < e; i++) {
-      ExprResult Arg = DefaultVariadicArgumentPromotion(Args[i], 
VariadicMethod,
-                                                        nullptr);
+      ExprResult Arg = DefaultVariadicArgumentPromotion(
+          Args[i], VariadicCallType::Method, nullptr);
       IsError |= Arg.isInvalid();
       MethodArgs.push_back(Arg.get());
     }


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to