[clang] [RFC] [clang] [CodeGen] Avoid creating global variable repeatedly when type are not specified (PR #114948)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 00:16:22 PST 2024


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 70de0b8bea31bb734bce86581574a60a0968d838 5b7def2c1deb4315cd043bc090a7364edbaeb84c --extensions c,cpp -- clang/lib/CodeGen/CodeGenModule.cpp clang/test/CodeGen/attr-weakref2.c
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 9566cfb8d6..75c1eb8bfa 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -5239,7 +5239,8 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D,
   QualType ASTTy = D->getType();
   LangAS AddrSpace = ASTTy.getAddressSpace();
 
-  if (Entry && !Ty && Entry->getAddressSpace() == getContext().getTargetAddressSpace(AddrSpace))
+  if (Entry && !Ty &&
+      Entry->getAddressSpace() == getContext().getTargetAddressSpace(AddrSpace))
     return Entry;
 
   if (!Ty)

``````````

</details>


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


More information about the cfe-commits mailing list