@@ -951,7 +951,7 @@ ExprResult Sema::DefaultArgumentPromotion(Expr *E) {
951
951
return E;
952
952
}
953
953
954
- Sema:: VarArgKind Sema::isValidVarArgType(const QualType &Ty) {
954
+ VarArgKind Sema::isValidVarArgType(const QualType &Ty) {
955
955
if (Ty->isIncompleteType()) {
956
956
// C++11 [expr.call]p7:
957
957
// After these conversions, if the argument does not have arithmetic,
@@ -962,23 +962,23 @@ Sema::VarArgKind Sema::isValidVarArgType(const QualType &Ty) {
962
962
// decay and function-to-pointer decay, the only such type in C++ is cv
963
963
// void. This also handles initializer lists as variadic arguments.
964
964
if (Ty->isVoidType())
965
- return VAK_Invalid ;
965
+ return VarArgKind::Invalid ;
966
966
967
967
if (Ty->isObjCObjectType())
968
- return VAK_Invalid ;
969
- return VAK_Valid ;
968
+ return VarArgKind::Invalid ;
969
+ return VarArgKind::Valid ;
970
970
}
971
971
972
972
if (Ty.isDestructedType() == QualType::DK_nontrivial_c_struct)
973
- return VAK_Invalid ;
973
+ return VarArgKind::Invalid ;
974
974
975
975
if (Context.getTargetInfo().getTriple().isWasm() &&
976
976
Ty.isWebAssemblyReferenceType()) {
977
- return VAK_Invalid ;
977
+ return VarArgKind::Invalid ;
978
978
}
979
979
980
980
if (Ty.isCXX98PODType(Context))
981
- return VAK_Valid ;
981
+ return VarArgKind::Valid ;
982
982
983
983
// C++11 [expr.call]p7:
984
984
// Passing a potentially-evaluated argument of class type (Clause 9)
@@ -990,26 +990,26 @@ Sema::VarArgKind Sema::isValidVarArgType(const QualType &Ty) {
990
990
if (!Record->hasNonTrivialCopyConstructor() &&
991
991
!Record->hasNonTrivialMoveConstructor() &&
992
992
!Record->hasNonTrivialDestructor())
993
- return VAK_ValidInCXX11 ;
993
+ return VarArgKind::ValidInCXX11 ;
994
994
995
995
if (getLangOpts().ObjCAutoRefCount && Ty->isObjCLifetimeType())
996
- return VAK_Valid ;
996
+ return VarArgKind::Valid ;
997
997
998
998
if (Ty->isObjCObjectType())
999
- return VAK_Invalid ;
999
+ return VarArgKind::Invalid ;
1000
1000
1001
1001
if (getLangOpts().HLSL && Ty->getAs<HLSLAttributedResourceType>())
1002
- return VAK_Valid ;
1002
+ return VarArgKind::Valid ;
1003
1003
1004
1004
if (getLangOpts().MSVCCompat)
1005
- return VAK_MSVCUndefined ;
1005
+ return VarArgKind::MSVCUndefined ;
1006
1006
1007
1007
if (getLangOpts().HLSL && Ty->getAs<HLSLAttributedResourceType>())
1008
- return VAK_Valid ;
1008
+ return VarArgKind::Valid ;
1009
1009
1010
1010
// FIXME: In C++11, these cases are conditionally-supported, meaning we're
1011
1011
// permitted to reject them. We should consider doing so.
1012
- return VAK_Undefined ;
1012
+ return VarArgKind::Undefined ;
1013
1013
}
1014
1014
1015
1015
void Sema::checkVariadicArgument(const Expr *E, VariadicCallType CT) {
@@ -1019,12 +1019,12 @@ void Sema::checkVariadicArgument(const Expr *E, VariadicCallType CT) {
1019
1019
1020
1020
// Complain about passing non-POD types through varargs.
1021
1021
switch (VAK) {
1022
- case VAK_ValidInCXX11 :
1022
+ case VarArgKind::ValidInCXX11 :
1023
1023
DiagRuntimeBehavior(
1024
1024
E->getBeginLoc(), nullptr,
1025
1025
PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg) << Ty << CT);
1026
1026
[[fallthrough]];
1027
- case VAK_Valid :
1027
+ case VarArgKind::Valid :
1028
1028
if (Ty->isRecordType()) {
1029
1029
// This is unlikely to be what the user intended. If the class has a
1030
1030
// 'c_str' member function, the user probably meant to call that.
@@ -1034,14 +1034,14 @@ void Sema::checkVariadicArgument(const Expr *E, VariadicCallType CT) {
1034
1034
}
1035
1035
break;
1036
1036
1037
- case VAK_Undefined :
1038
- case VAK_MSVCUndefined :
1037
+ case VarArgKind::Undefined :
1038
+ case VarArgKind::MSVCUndefined :
1039
1039
DiagRuntimeBehavior(E->getBeginLoc(), nullptr,
1040
1040
PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
1041
1041
<< getLangOpts().CPlusPlus11 << Ty << CT);
1042
1042
break;
1043
1043
1044
- case VAK_Invalid :
1044
+ case VarArgKind::Invalid :
1045
1045
if (Ty.isDestructedType() == QualType::DK_nontrivial_c_struct)
1046
1046
Diag(E->getBeginLoc(),
1047
1047
diag::err_cannot_pass_non_trivial_c_struct_to_vararg)
@@ -1087,7 +1087,7 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT,
1087
1087
1088
1088
// Diagnostics regarding non-POD argument types are
1089
1089
// emitted along with format string checking in Sema::CheckFunctionCall().
1090
- if (isValidVarArgType(E->getType()) == VAK_Undefined ) {
1090
+ if (isValidVarArgType(E->getType()) == VarArgKind::Undefined ) {
1091
1091
// Turn this into a trap.
1092
1092
CXXScopeSpec SS;
1093
1093
SourceLocation TemplateKWLoc;
0 commit comments