[clang] [clang codegen][NFC] Delete dead code in constant emission. (PR #90106)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 12:19:40 PDT 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 758d97dce0c669a0ba6927728b40030a76acb144 b9e5e50524a6ff91badfd5729846d5c948f1d4ce -- clang/lib/CodeGen/CGExprAgg.cpp clang/lib/CodeGen/CGExprConstant.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/ConstantEmitter.h
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index 91582c3257..7d22d3c5b1 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -925,8 +925,8 @@ tryEmitGlobalCompoundLiteral(ConstantEmitter &emitter,
     return ConstantAddress(Addr, Addr->getValueType(), Align);
 
   LangAS addressSpace = E->getType().getAddressSpace();
-  llvm::Constant *C = emitter.tryEmitForInitializer(E->getInitializer(),
-                                                    E->getType());
+  llvm::Constant *C =
+      emitter.tryEmitForInitializer(E->getInitializer(), E->getType());
   if (!C) {
     assert(!E->isFileScope() &&
            "file-scope compound literal did not have constant initializer!");
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index a6592311c7..536ed2998a 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3575,8 +3575,8 @@ ConstantAddress CodeGenModule::GetAddrOfTemplateParamObject(
     return ConstantAddress(GV, GV->getValueType(), Alignment);
 
   ConstantEmitter Emitter(*this);
-  llvm::Constant *Init = Emitter.emitForInitializer(
-        TPO->getValue(), TPO->getType());
+  llvm::Constant *Init =
+      Emitter.emitForInitializer(TPO->getValue(), TPO->getType());
 
   if (!Init) {
     ErrorUnsupported(TPO, "template parameter object");
@@ -6518,8 +6518,7 @@ ConstantAddress CodeGenModule::GetAddrOfGlobalTemporary(
   if (Value) {
     // The temporary has a constant initializer, use it.
     emitter.emplace(*this);
-    InitialValue = emitter->emitForInitializer(*Value,
-                                               MaterializedType);
+    InitialValue = emitter->emitForInitializer(*Value, MaterializedType);
     Constant =
         MaterializedType.isConstantStorage(getContext(), /*ExcludeCtor*/ Value,
                                            /*ExcludeDtor*/ false);

``````````

</details>


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


More information about the cfe-commits mailing list