[clang] [clang] Improve bit-field in ref NTTP diagnostic (PR #71077)

via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 3 08:02:51 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 9f78edbd20ed922cced9482f7791deb9899a6d82 bc2ea1ab74b613f700b11390a4715a0f2bec10e7 -- clang/lib/Sema/SemaOverload.cpp clang/test/CXX/drs/dr12xx.cpp clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index befc27811e..739951fd48 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -123,43 +123,21 @@ CompareDerivedToBaseConversions(Sema &S, SourceLocation Loc,
 /// GetConversionRank - Retrieve the implicit conversion rank
 /// corresponding to the given implicit conversion kind.
 ImplicitConversionRank clang::GetConversionRank(ImplicitConversionKind Kind) {
-  static const ImplicitConversionRank
-    Rank[] = {
-    ICR_Exact_Match,
-    ICR_Exact_Match,
-    ICR_Exact_Match,
-    ICR_Exact_Match,
-    ICR_Exact_Match,
-    ICR_Exact_Match,
-    ICR_Promotion,
-    ICR_Promotion,
-    ICR_Promotion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_OCL_Scalar_Widening,
-    ICR_Complex_Real_Conversion,
-    ICR_Conversion,
-    ICR_Conversion,
-    ICR_Writeback_Conversion,
-    ICR_Exact_Match, // NOTE(gbiv): This may not be completely right --
-                     // it was omitted by the patch that added
-                     // ICK_Zero_Event_Conversion
-    ICR_Exact_Match, // NOTE(ctopper): This may not be completely right --
-                     // it was omitted by the patch that added
-                     // ICK_Zero_Queue_Conversion
-    ICR_C_Conversion,
-    ICR_C_Conversion_Extension
-  };
+  static const ImplicitConversionRank Rank[] = {
+      ICR_Exact_Match, ICR_Exact_Match, ICR_Exact_Match, ICR_Exact_Match,
+      ICR_Exact_Match, ICR_Exact_Match, ICR_Promotion, ICR_Promotion,
+      ICR_Promotion, ICR_Conversion, ICR_Conversion, ICR_Conversion,
+      ICR_Conversion, ICR_Conversion, ICR_Conversion, ICR_Conversion,
+      ICR_Conversion, ICR_Conversion, ICR_Conversion, ICR_Conversion,
+      ICR_Conversion, ICR_OCL_Scalar_Widening, ICR_Complex_Real_Conversion,
+      ICR_Conversion, ICR_Conversion, ICR_Writeback_Conversion,
+      ICR_Exact_Match, // NOTE(gbiv): This may not be completely right --
+                       // it was omitted by the patch that added
+                       // ICK_Zero_Event_Conversion
+      ICR_Exact_Match, // NOTE(ctopper): This may not be completely right --
+                       // it was omitted by the patch that added
+                       // ICK_Zero_Queue_Conversion
+      ICR_C_Conversion, ICR_C_Conversion_Extension};
   static_assert(std::size(Rank) == (int)ICK_Num_Conversion_Kinds);
   return Rank[(int)Kind];
 }
@@ -167,38 +145,36 @@ ImplicitConversionRank clang::GetConversionRank(ImplicitConversionKind Kind) {
 /// GetImplicitConversionName - Return the name of this kind of
 /// implicit conversion.
 static const char* GetImplicitConversionName(ImplicitConversionKind Kind) {
-  static const char* const Name[] = {
-    "No conversion",
-    "Lvalue-to-rvalue",
-    "Array-to-pointer",
-    "Function-to-pointer",
-    "Function pointer conversion",
-    "Qualification",
-    "Integral promotion",
-    "Floating point promotion",
-    "Complex promotion",
-    "Integral conversion",
-    "Floating conversion",
-    "Complex conversion",
-    "Floating-integral conversion",
-    "Pointer conversion",
-    "Pointer-to-member conversion",
-    "Boolean conversion",
-    "Compatible-types conversion",
-    "Derived-to-base conversion",
-    "Vector conversion",
-    "SVE Vector conversion",
-    "RVV Vector conversion",
-    "Vector splat",
-    "Complex-real conversion",
-    "Block Pointer conversion",
-    "Transparent Union Conversion",
-    "Writeback conversion",
-    "OpenCL Zero Event Conversion",
-    "OpenCL Zero Queue Conversion",
-    "C specific type conversion",
-    "Incompatible pointer conversion"
-  };
+  static const char *const Name[] = {"No conversion",
+                                     "Lvalue-to-rvalue",
+                                     "Array-to-pointer",
+                                     "Function-to-pointer",
+                                     "Function pointer conversion",
+                                     "Qualification",
+                                     "Integral promotion",
+                                     "Floating point promotion",
+                                     "Complex promotion",
+                                     "Integral conversion",
+                                     "Floating conversion",
+                                     "Complex conversion",
+                                     "Floating-integral conversion",
+                                     "Pointer conversion",
+                                     "Pointer-to-member conversion",
+                                     "Boolean conversion",
+                                     "Compatible-types conversion",
+                                     "Derived-to-base conversion",
+                                     "Vector conversion",
+                                     "SVE Vector conversion",
+                                     "RVV Vector conversion",
+                                     "Vector splat",
+                                     "Complex-real conversion",
+                                     "Block Pointer conversion",
+                                     "Transparent Union Conversion",
+                                     "Writeback conversion",
+                                     "OpenCL Zero Event Conversion",
+                                     "OpenCL Zero Queue Conversion",
+                                     "C specific type conversion",
+                                     "Incompatible pointer conversion"};
   static_assert(std::size(Name) == (int)ICK_Num_Conversion_Kinds);
   return Name[Kind];
 }
@@ -6208,7 +6184,6 @@ ExprResult Sema::CheckConvertedConstantExpression(Expr *From, QualType T,
   return R;
 }
 
-
 /// dropPointerConversions - If the given standard conversion sequence
 /// involves any pointer conversions, remove them.  This may change
 /// the result type of the conversion sequence.
@@ -10129,8 +10104,8 @@ static bool haveSameParameterTypes(ASTContext &Context, const FunctionDecl *F1,
 /// F1 and F2 are non-template functions with the same parameter-type-lists,
 /// and F1 is more constrained than F2 [...]
 static bool sameFunctionParameterTypeLists(Sema &S,
-                                          const OverloadCandidate &Cand1,
-                                          const OverloadCandidate &Cand2) {
+                                           const OverloadCandidate &Cand1,
+                                           const OverloadCandidate &Cand2) {
   if (Cand1.Function && Cand2.Function) {
     auto *PT1 = cast<FunctionProtoType>(Cand1.Function->getFunctionType());
     auto *PT2 = cast<FunctionProtoType>(Cand2.Function->getFunctionType());
@@ -12118,8 +12093,8 @@ struct CompareOverloadCandidatesForDisplay {
           return true;
 
         if (L->DeductionFailure.Result != R->DeductionFailure.Result)
-          return RankDeductionFailure(L->DeductionFailure)
-               < RankDeductionFailure(R->DeductionFailure);
+          return RankDeductionFailure(L->DeductionFailure) <
+                 RankDeductionFailure(R->DeductionFailure);
       } else if (RFailureKind == ovl_fail_bad_deduction)
         return false;
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/71077


More information about the cfe-commits mailing list