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 0e6c679c1a5c0d3f101335c904583b5d62cb51d3 73c0b9f0bdf44710a290a17c8d87bc0e3db393ef -- clang/include/clang/Sema/Overload.h clang/lib/AST/Expr.cpp clang/lib/AST/ExprConstant.cpp clang/lib/CodeGen/CGExpr.cpp clang/lib/CodeGen/CGExprAgg.cpp clang/lib/CodeGen/CGExprComplex.cpp clang/lib/CodeGen/CGExprConstant.cpp clang/lib/CodeGen/CGExprScalar.cpp clang/lib/Edit/RewriteObjCFoundationAPI.cpp clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaExprCXX.cpp clang/lib/Sema/SemaInit.cpp clang/lib/Sema/SemaOverload.cpp clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp `````````` </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 0e0f7f205eae..a2085a823b32 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -4986,7 +4986,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { return MakeAddrLValue(V, E->getType(), LV.getBaseInfo(), CGM.getTBAAInfoForSubobject(LV, E->getType())); } - + case CK_ZeroToOCLOpaqueType: llvm_unreachable("NULL to OpenCL opaque type lvalue cast is not valid"); } diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index b43eb1891481..7e2dd2f0fecd 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -1633,11 +1633,10 @@ namespace { // Form a GEP and then bitcast to the placeholder type so that the // replacement will succeed. - llvm::Constant *location = - llvm::ConstantExpr::getInBoundsGetElementPtr(BaseValueTy, - Base, IndexValues); - location = llvm::ConstantExpr::getBitCast(location, - placeholder->getType()); + llvm::Constant *location = llvm::ConstantExpr::getInBoundsGetElementPtr( + BaseValueTy, Base, IndexValues); + location = + llvm::ConstantExpr::getBitCast(location, placeholder->getType()); Locations.insert({placeholder, location}); } @@ -2038,8 +2037,8 @@ ConstantLValue ConstantLValueEmitter::VisitAddrLabelExpr(const AddrLabelExpr *E) { assert(Emitter.CGF && "Invalid address of label expression outside function"); llvm::Constant *Ptr = Emitter.CGF->GetAddrOfLabel(E->getLabel()); - Ptr = llvm::ConstantExpr::getBitCast(Ptr, - CGM.getTypes().ConvertType(E->getType())); + Ptr = llvm::ConstantExpr::getBitCast( + Ptr, CGM.getTypes().ConvertType(E->getType())); return Ptr; } diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 61641c1131c3..b48b329fd2c5 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -2484,7 +2484,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { case CK_IntToOCLSampler: return CGF.CGM.createOpenCLIntToSamplerConversion(E, CGF); - + case CK_VectorTruncation: { assert(DestTy->isVectorType() && "Expected dest type to be vector type"); Value *Vec = Visit(const_cast<Expr *>(E)); diff --git a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp index 5ff9e3ee39d2..699de63991f5 100644 --- a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp +++ b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp @@ -1086,7 +1086,7 @@ static bool rewriteToNumericBoxedExpression(const ObjCMessageExpr *Msg, case CK_BooleanToSignedIntegral: llvm_unreachable("OpenCL-specific cast in Objective-C?"); - + case CK_VectorTruncation: llvm_unreachable("HLSL-specific cast in Objective-C?"); break; diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 83dcb615ccc0..daf4b8f04d2f 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -4716,7 +4716,8 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, auto *FromVec = From->getType()->castAs<ExtVectorType>(); auto *ToVec = ToType->castAs<ExtVectorType>(); QualType ElType = FromVec->getElementType(); - QualType TruncTy = Context.getExtVectorType(ElType, ToVec->getNumElements()); + QualType TruncTy = + Context.getExtVectorType(ElType, ToVec->getNumElements()); From = ImpCastExprToType(From, TruncTy, CK_VectorTruncation, From->getValueKind()) .get(); @@ -4760,8 +4761,8 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, } From = - ImpCastExprToType(From, ToType, - ScalarTypeToBooleanCastKind(FromElTy), VK_PRValue, + ImpCastExprToType(From, ToType, ScalarTypeToBooleanCastKind(FromElTy), + VK_PRValue, /*BasePath=*/nullptr, CCK) .get(); break; diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 98ddc49bfe2c..0c55e64a881b 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -123,44 +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, - ICR_C_Conversion - }; + 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, ICR_C_Conversion}; static_assert(std::size(Rank) == (int)ICK_Num_Conversion_Kinds); return Rank[(int)Kind]; } @@ -168,39 +145,37 @@ 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", - "HLSL vector truncation" - }; + 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", + "HLSL vector truncation"}; static_assert(std::size(Name) == (int)ICK_Num_Conversion_Kinds); return Name[Kind]; } @@ -1950,7 +1925,7 @@ static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType, QualType FromElTy = FromType->getAs<VectorType>()->getElementType(); QualType ToElTy = ToType->getAs<VectorType>()->getElementType(); - if (S.Context.hasSameUnqualifiedType(FromElTy,ToElTy)) + if (S.Context.hasSameUnqualifiedType(FromElTy, ToElTy)) return true; return IsVectorElementConversion(S, FromElTy, ToElTy, ElConv, From); } `````````` </details> https://github.com/llvm/llvm-project/pull/71098 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits