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,c,h -- 
clang/test/CodeGen/ms-stack-protector-gs-buffer.c 
clang/include/clang/Basic/LangOptions.h clang/lib/CodeGen/CGBuiltin.cpp 
clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGDecl.cpp 
clang/lib/CodeGen/CGExpr.cpp clang/lib/CodeGen/CodeGenFunction.cpp 
clang/lib/CodeGen/CodeGenFunction.h clang/lib/CodeGen/CodeGenModule.cpp 
clang/lib/CodeGen/CodeGenModule.h clang/lib/Driver/ToolChains/Clang.cpp 
clang/test/Driver/cl-options.c llvm/lib/CodeGen/StackProtector.cpp 
llvm/lib/IR/Attributes.cpp 
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp 
--diff_from_common_commit
``````````

: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/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index cd8796456..4c087b248 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -5293,11 +5293,10 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, 
const Expr *E,
       type->castAsRecordDecl()->isParamDestroyedInCallee()) {
     // If we're using inalloca, use the argument memory.  Otherwise, use a
     // temporary.
-    AggValueSlot Slot =
-        args.isUsingInAlloca()
-            ? createPlaceholderSlot(*this, type)
-            : CreateAggTemp(type, "agg.tmp", /*Alloca=*/nullptr,
-                            GSObjectKind::ArgumentCopy);
+    AggValueSlot Slot = args.isUsingInAlloca()
+                            ? createPlaceholderSlot(*this, type)
+                            : CreateAggTemp(type, "agg.tmp", 
/*Alloca=*/nullptr,
+                                            GSObjectKind::ArgumentCopy);
 
     bool DestroyedInCallee = true, NeedsCleanup = true;
     if (const auto *RD = type->getAsCXXRecordDecl())
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 2b64f7d98..0407011ba 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -1676,8 +1676,9 @@ static bool isGSBuffer(const ASTContext &Ctx, QualType Ty,
   if (const ConstantArrayType *CAT = Ctx.getAsConstantArrayType(Ty)) {
     QualType ElemTy = CAT->getElementType();
     if (Ctx.getTypeSizeInChars(Ty).getQuantity() > MinGSArraySize &&
-        (Position == GSTypePosition::TopLevel ? hasMoreThanTwoGSElements(Ctx, 
Ty)
-                                              : !isGSPointerType(ElemTy)))
+        (Position == GSTypePosition::TopLevel
+             ? hasMoreThanTwoGSElements(Ctx, Ty)
+             : !isGSPointerType(ElemTy)))
       return Found(Ty);
 
     // The array itself is not a GS buffer, but its elements may still be or
@@ -1731,9 +1732,9 @@ void CodeGenFunction::MarkGSBufferAlloca(llvm::AllocaInst 
*AI, bool IsLarge,
   if (AI->getMetadata("stack-protector"))
     return;
 
-  // 2 is a large buffer and 1 a small one. The second operand says the object 
is
-  // trivial, and is left out when it is not, which is the common case; see the
-  // "stack-protector" metadata in LLVM's LangRef.
+  // 2 is a large buffer and 1 a small one. The second operand says the object
+  // is trivial, and is left out when it is not, which is the common case; see
+  // the "stack-protector" metadata in LLVM's LangRef.
   llvm::LLVMContext &Ctx = Builder.getContext();
   SmallVector<llvm::Metadata *, 2> Ops = {
       llvm::ConstantAsMetadata::get(Builder.getInt32(IsLarge ? 2 : 1))};
@@ -1768,8 +1769,8 @@ void 
CodeGenFunction::EmitGSBufferStackProtectorMD(llvm::Value *AllocaPtr,
   // and the destructor runs on the original.
   if (Kind == GSObjectKind::ArgumentCopy) {
     const auto *RD = Ty->getAsCXXRecordDecl();
-    if (RD && !(RD->hasSimpleCopyConstructor() &&
-                RD->hasTrivialCopyConstructor()))
+    if (RD &&
+        !(RD->hasSimpleCopyConstructor() && RD->hasTrivialCopyConstructor()))
       return;
   }
 
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index b8554583c..0ab00f364 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -203,8 +203,7 @@ RawAddress CodeGenFunction::CreateMemTemp(QualType Ty, 
const Twine &Name,
 }
 
 RawAddress CodeGenFunction::CreateMemTemp(QualType Ty, CharUnits Align,
-                                          const Twine &Name,
-                                          RawAddress *Alloca,
+                                          const Twine &Name, RawAddress 
*Alloca,
                                           GSObjectKind GSKind) {
   RawAddress Result =
       CreateTempAlloca(ConvertTypeForMem(Ty), Ty.getAddressSpace(), Align, 
Name,
diff --git a/llvm/lib/CodeGen/StackProtector.cpp 
b/llvm/lib/CodeGen/StackProtector.cpp
index 05e6fa85f..b8476f347 100644
--- a/llvm/lib/CodeGen/StackProtector.cpp
+++ b/llvm/lib/CodeGen/StackProtector.cpp
@@ -106,10 +106,10 @@ static std::optional<uint32_t> getSSPAllocaMD(const 
AllocaInst &AI,
 ///
 /// cl.exe gives such an allocation a slot in the frame's temporary area, which
 /// the cookie does not cover, and leaves it out of the GS analysis: the only
-/// code that writes it from outside is a callee, and a callee writes exactly 
one
-/// object of the type it returns. As soon as the address reaches anywhere 
else,
-/// cl.exe relocates the object into the protected region instead, so look for
-/// that here rather than in the frontend, which cannot see the uses.
+/// code that writes it from outside is a callee, and a callee writes exactly
+/// one object of the type it returns. As soon as the address reaches anywhere
+/// else, cl.exe relocates the object into the protected region instead, so 
look
+/// for that here rather than in the frontend, which cannot see the uses.
 ///
 /// Only an object cl.exe is free to relocate can end up in that area, which is
 /// why the caller also requires the allocation to hold a trivial object.

``````````

</details>


https://github.com/llvm/llvm-project/pull/225626
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to