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 8f76f1816ea63b7cc28e150ba319ffbfe6351f9e b286b9b07d60a7b3243ad5e8e6959a4d7d7fda49 -- clang/include/clang/Basic/ObjCRuntime.h clang/lib/CodeGen/CGObjCGNU.cpp `````````` </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index a71f42169f..44fdef5ac5 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -2030,78 +2030,78 @@ class CGObjCGNUstep2 : public CGObjCGNUstep { // ... if (OMD->isClassMethod()) { - const ObjCInterfaceDecl *OID = cast<ObjCInterfaceDecl>(CD); + const ObjCInterfaceDecl *OID = cast<ObjCInterfaceDecl>(CD); - // Nullable `Class` expressions cannot be messaged with a direct method - // so the only reason why the receive can be null would be because - // of weak linking. - ReceiverCanBeNull = isWeakLinkedClass(OID); + // Nullable `Class` expressions cannot be messaged with a direct method + // so the only reason why the receive can be null would be because + // of weak linking. + ReceiverCanBeNull = isWeakLinkedClass(OID); } if (ReceiverCanBeNull) { - llvm::BasicBlock *SelfIsNilBlock = - CGF.createBasicBlock("objc_direct_method.self_is_nil"); - llvm::BasicBlock *ContBlock = - CGF.createBasicBlock("objc_direct_method.cont"); - - // if (self == nil) { - auto selfTy = cast<llvm::PointerType>(selfValue->getType()); - auto Zero = llvm::ConstantPointerNull::get(selfTy); - - llvm::MDBuilder MDHelper(CGM.getLLVMContext()); - Builder.CreateCondBr(Builder.CreateICmpEQ(selfValue, Zero), - SelfIsNilBlock, ContBlock, - MDHelper.createBranchWeights(1, 1 << 20)); - - CGF.EmitBlock(SelfIsNilBlock); - - // return (ReturnType){ }; - auto retTy = OMD->getReturnType(); - Builder.SetInsertPoint(SelfIsNilBlock); - if (!retTy->isVoidType()) { - CGF.EmitNullInitialization(CGF.ReturnValue, retTy); - } - CGF.EmitBranchThroughCleanup(CGF.ReturnBlock); - // } + llvm::BasicBlock *SelfIsNilBlock = + CGF.createBasicBlock("objc_direct_method.self_is_nil"); + llvm::BasicBlock *ContBlock = + CGF.createBasicBlock("objc_direct_method.cont"); + + // if (self == nil) { + auto selfTy = cast<llvm::PointerType>(selfValue->getType()); + auto Zero = llvm::ConstantPointerNull::get(selfTy); + + llvm::MDBuilder MDHelper(CGM.getLLVMContext()); + Builder.CreateCondBr(Builder.CreateICmpEQ(selfValue, Zero), + SelfIsNilBlock, ContBlock, + MDHelper.createBranchWeights(1, 1 << 20)); + + CGF.EmitBlock(SelfIsNilBlock); + + // return (ReturnType){ }; + auto retTy = OMD->getReturnType(); + Builder.SetInsertPoint(SelfIsNilBlock); + if (!retTy->isVoidType()) { + CGF.EmitNullInitialization(CGF.ReturnValue, retTy); + } + CGF.EmitBranchThroughCleanup(CGF.ReturnBlock); + // } - // rest of the body - CGF.EmitBlock(ContBlock); - Builder.SetInsertPoint(ContBlock); + // rest of the body + CGF.EmitBlock(ContBlock); + Builder.SetInsertPoint(ContBlock); } if (OMD->isClassMethod()) { - // Prefix of the class type. - auto *classStart = - llvm::StructType::get(PtrTy, PtrTy, PtrTy, LongTy, LongTy); - auto &astContext = CGM.getContext(); - auto flags = Builder.CreateLoad( - Address{Builder.CreateStructGEP(classStart, selfValue, 4), LongTy, - CharUnits::fromQuantity( - astContext.getTypeAlign(astContext.UnsignedLongTy))}); - auto isInitialized = Builder.CreateAnd(flags, (1 << 8)); - llvm::BasicBlock *notInitializedBlock = - CGF.createBasicBlock("objc_direct_method.send_initialize"); - llvm::BasicBlock *initializedBlock = - CGF.createBasicBlock("objc_direct_method.class_initialized"); - llvm::MDBuilder MDHelper(CGM.getLLVMContext()); - Builder.CreateCondBr(Builder.CreateICmpEQ(isInitialized, Zeros[0]), - notInitializedBlock, initializedBlock, - MDHelper.createBranchWeights(1, 1 << 20)); - CGF.EmitBlock(notInitializedBlock); - Builder.SetInsertPoint(notInitializedBlock); - CGF.EmitRuntimeCall(SentInitializeFn, selfValue); - Builder.CreateBr(initializedBlock); - CGF.EmitBlock(initializedBlock); - Builder.SetInsertPoint(initializedBlock); + // Prefix of the class type. + auto *classStart = + llvm::StructType::get(PtrTy, PtrTy, PtrTy, LongTy, LongTy); + auto &astContext = CGM.getContext(); + auto flags = Builder.CreateLoad( + Address{Builder.CreateStructGEP(classStart, selfValue, 4), LongTy, + CharUnits::fromQuantity( + astContext.getTypeAlign(astContext.UnsignedLongTy))}); + auto isInitialized = Builder.CreateAnd(flags, (1 << 8)); + llvm::BasicBlock *notInitializedBlock = + CGF.createBasicBlock("objc_direct_method.send_initialize"); + llvm::BasicBlock *initializedBlock = + CGF.createBasicBlock("objc_direct_method.class_initialized"); + llvm::MDBuilder MDHelper(CGM.getLLVMContext()); + Builder.CreateCondBr(Builder.CreateICmpEQ(isInitialized, Zeros[0]), + notInitializedBlock, initializedBlock, + MDHelper.createBranchWeights(1, 1 << 20)); + CGF.EmitBlock(notInitializedBlock); + Builder.SetInsertPoint(notInitializedBlock); + CGF.EmitRuntimeCall(SentInitializeFn, selfValue); + Builder.CreateBr(initializedBlock); + CGF.EmitBlock(initializedBlock); + Builder.SetInsertPoint(initializedBlock); } // only synthesize _cmd if it's referenced if (OMD->getCmdDecl()->isUsed()) { - // `_cmd` is not a parameter to direct methods, so storage must be - // explicitly declared for it. - CGF.EmitVarDecl(*OMD->getCmdDecl()); - Builder.CreateStore(GetSelector(CGF, OMD), - CGF.GetAddrOfLocalVar(OMD->getCmdDecl())); + // `_cmd` is not a parameter to direct methods, so storage must be + // explicitly declared for it. + CGF.EmitVarDecl(*OMD->getCmdDecl()); + Builder.CreateStore(GetSelector(CGF, OMD), + CGF.GetAddrOfLocalVar(OMD->getCmdDecl())); } } }; @@ -4053,7 +4053,7 @@ llvm::Function *CGObjCGNU::GenerateMethod(const ObjCMethodDecl *OMD, // If these do not match, then we'll replace this function with // a new one that has the proper type below. if (!OMD->getBody() || COMD->getReturnType() == OMD->getReturnType()) - return I->second; + return I->second; OldFn = I->second; } `````````` </details> https://github.com/llvm/llvm-project/pull/78030 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits