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 origin/main HEAD --extensions cpp,h,c -- clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/CodeGen/CodeGenFunction.h clang/test/CodeGen/attr-cleanup.c `````````` :warning: The reproduction instructions above might return results for more than one PR in a stack if you are using a stacked PR workflow. You can limit the results by changing `origin/main` to the base branch/commit you want to compare against. :warning: </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 8d7e19068..2b478ea70 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -2232,10 +2232,12 @@ void CodeGenFunction::EmitAutoVarCleanups(const AutoVarEmission &emission) { // Check if we're in C89 mode and should defer cleanup to function scope bool isC89Mode = !getLangOpts().C99 && !getLangOpts().CPlusPlus; if (isC89Mode) { - const CGFunctionInfo &Info = CGM.getTypes().arrangeFunctionDeclaration(FD); + const CGFunctionInfo &Info = + CGM.getTypes().arrangeFunctionDeclaration(FD); addDeferredFunctionCleanup(F, &Info, &D, CA); } else { - const CGFunctionInfo &Info = CGM.getTypes().arrangeFunctionDeclaration(FD); + const CGFunctionInfo &Info = + CGM.getTypes().arrangeFunctionDeclaration(FD); EHStack.pushCleanup<CallCleanupFunction>(NormalAndEHCleanup, F, &Info, &D, CA); } @@ -2977,11 +2979,9 @@ void CodeGenFunction::addDeferredFunctionCleanup(llvm::Constant *F, void CodeGenFunction::processDeferredFunctionCleanups() { // Process all deferred cleanups at function exit for (const auto &cleanup : DeferredFunctionCleanups) { - EHStack.pushCleanup<CallCleanupFunction>(NormalAndEHCleanup, - cleanup.CleanupFn, - cleanup.FnInfo, - cleanup.Var, - cleanup.Attribute); + EHStack.pushCleanup<CallCleanupFunction>(NormalAndEHCleanup, + cleanup.CleanupFn, cleanup.FnInfo, + cleanup.Var, cleanup.Attribute); } DeferredFunctionCleanups.clear(); } diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 95a4cc371..42ae45e5a 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -405,10 +405,10 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { // parameters. Do this in whatever block we're currently in; it's // important to do this before we enter the return block or return // edges will be *really* confused. - + // Process deferred function cleanups before checking for regular cleanups processDeferredFunctionCleanups(); - + bool HasCleanups = EHStack.stable_begin() != PrologueCleanupDepth; bool HasOnlyNoopCleanups = HasCleanups && EHStack.containsOnlyNoopCleanups(PrologueCleanupDepth); @@ -426,7 +426,7 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { // fall back to an artificial location if needed. OAL = ApplyDebugLocation::CreateDefaultArtificial(*this, EndLoc); } - + PopCleanupBlocks(PrologueCleanupDepth); } diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index f095d59b0..6827c66c0 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -392,19 +392,21 @@ public: /// cleanups associated with the parameters. EHScopeStack::stable_iterator PrologueCleanupDepth; - /// Structure for deferred function-level cleanups (e.g., C89 for-init cleanup variables) + /// Structure for deferred function-level cleanups (e.g., C89 for-init cleanup + /// variables) struct DeferredCleanupInfo { llvm::Constant *CleanupFn; const CGFunctionInfo *FnInfo; const VarDecl *Var; const CleanupAttr *Attribute; - - DeferredCleanupInfo(llvm::Constant *F, const CGFunctionInfo *Info, + + DeferredCleanupInfo(llvm::Constant *F, const CGFunctionInfo *Info, const VarDecl *V, const CleanupAttr *A) - : CleanupFn(F), FnInfo(Info), Var(V), Attribute(A) {} + : CleanupFn(F), FnInfo(Info), Var(V), Attribute(A) {} }; - - /// List of cleanups that should be registered at function exit instead of current scope + + /// List of cleanups that should be registered at function exit instead of + /// current scope SmallVector<DeferredCleanupInfo, 4> DeferredFunctionCleanups; /// ReturnBlock - Unified return block. @@ -3485,11 +3487,14 @@ public: void EmitAutoVarCleanups(const AutoVarEmission &emission); void emitAutoVarTypeCleanup(const AutoVarEmission &emission, QualType::DestructionKind dtorKind); - - /// Add a cleanup to be deferred until function exit (for C89 for-init variables) - void addDeferredFunctionCleanup(llvm::Constant *CleanupFn, const CGFunctionInfo *FnInfo, - const VarDecl *Var, const CleanupAttr *Attribute); - + + /// Add a cleanup to be deferred until function exit (for C89 for-init + /// variables) + void addDeferredFunctionCleanup(llvm::Constant *CleanupFn, + const CGFunctionInfo *FnInfo, + const VarDecl *Var, + const CleanupAttr *Attribute); + /// Process all deferred function-level cleanups void processDeferredFunctionCleanups(); `````````` </details> https://github.com/llvm/llvm-project/pull/156643 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits