[llvm] Implement Move-assignment for llvm::Module (NFC) (PR #117270)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 17:02:52 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 ec2da0ca19c393053c7f11d5478ae21c27e54f5c 1a7db96053705e67bc50adafe1de49d78c1b78ba --extensions h,cpp -- llvm/include/llvm/IR/Module.h llvm/lib/IR/Module.cpp llvm/unittests/IR/ModuleTest.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index 57946f21ed..ff95f123d4 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -82,7 +82,6 @@ Module &Module::operator=(Module &&Other) {
   assert(&Context == &Other.Context && "Module must be in the same Context");
 
   dropAllReferences();
-  
 
   ModuleID = std::move(Other.ModuleID);
   SourceFileName = std::move(Other.SourceFileName);
diff --git a/llvm/unittests/IR/ModuleTest.cpp b/llvm/unittests/IR/ModuleTest.cpp
index 5735c6cfe6..36c356730d 100644
--- a/llvm/unittests/IR/ModuleTest.cpp
+++ b/llvm/unittests/IR/ModuleTest.cpp
@@ -357,7 +357,7 @@ define void @Foo1() {
 !3 = !DILocation(line: 12, column: 34, scope: !4)
 !4 = distinct !DISubprogram(name: "foo1", scope: null, spFlags: DISPFlagDefinition, unit: !1)
 )",
-                                                Err, Context);
+                                                   Err, Context);
   ASSERT_TRUE(M1.get());
 
   StringLiteral M2Str = R"(
@@ -384,8 +384,7 @@ define void @Foo2() {
 !4 = distinct !DISubprogram(name: "foo2", scope: null, spFlags: DISPFlagDefinition, unit: !1)
 )";
   {
-    std::unique_ptr<Module> M2 = parseAssemblyString(M2Str,
-                                                Err, Context);
+    std::unique_ptr<Module> M2 = parseAssemblyString(M2Str, Err, Context);
     ASSERT_TRUE(M2.get());
     auto *GV1 = M1->getNamedValue("GV1");
     ASSERT_TRUE(GV1);
@@ -395,7 +394,7 @@ define void @Foo2() {
     *M1 = std::move(*M2);
     ASSERT_EQ(GV2->getParent(), &*M1);
   }
-   
+
   std::string M1Print;
   {
     llvm::raw_string_ostream Os(M1Print);

``````````

</details>


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


More information about the llvm-commits mailing list