[clang] [Clang][Tooling][NFC] Use move to avoid copies of large objects (PR #143603)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `ppc64le-flang-rhel-clang` running on `ppc64le-flang-rhel-test` while building `clang` at step 6 "test-build-unified-tree-check-flang". Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/30523 Here is the relevant piece of the build log for the reference ``` Step 6 (test-build-unified-tree-check-flang) failure: test (failure) TEST 'Flang :: Semantics/modfile75.F90' FAILED Exit Code: 2 Command Output (stderr): -- /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang -c -fhermetic-module-files -DWHICH=1 /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/modfile75.F90 && /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang -c -fhermetic-module-files -DWHICH=2 /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/modfile75.F90 && /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang -fc1 -fdebug-unparse /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/modfile75.F90 | /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/modfile75.F90 # RUN: at line 1 + /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang -c -fhermetic-module-files -DWHICH=1 /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/modfile75.F90 + /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang -c -fhermetic-module-files -DWHICH=2 /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/modfile75.F90 + /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang -fc1 -fdebug-unparse /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/modfile75.F90 + /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/modfile75.F90 error: Semantic errors in /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/modfile75.F90 /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/modfile75.F90:15:11: error: Must be a constant value integer(c_int) n ^ FileCheck error: '' is empty. FileCheck command line: /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/modfile75.F90 -- ``` https://github.com/llvm/llvm-project/pull/143603 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Tooling][NFC] Use move to avoid copies of large objects (PR #143603)
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/143603 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Tooling][NFC] Use move to avoid copies of large objects (PR #143603)
https://github.com/shafik updated
https://github.com/llvm/llvm-project/pull/143603
>From 6bcbd5e1691edd4cbc36bd0c318cdd3b526db1c3 Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour
Date: Tue, 10 Jun 2025 13:51:19 -0700
Subject: [PATCH 1/2] [Clang][Tooling][NFC] Use move to avoid copies of large
objects
Static analysis flagged these cases in which can use std::move and avoid copies
of large objects.
---
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index 44a270d5f7b35..b1495163ccc24 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -657,7 +657,7 @@ void ModuleDepCollectorPP::moduleImport(SourceLocation
ImportLoc,
P1689ModuleInfo RequiredModule;
RequiredModule.ModuleName = Path[0].getIdentifierInfo()->getName().str();
RequiredModule.Type = P1689ModuleInfo::ModuleType::NamedCXXModule;
-MDC.RequiredStdCXXModules.push_back(RequiredModule);
+MDC.RequiredStdCXXModules.push_back(std::move(RequiredModule));
return;
}
@@ -920,7 +920,7 @@ void ModuleDepCollectorPP::addAllSubmoduleDeps(
void ModuleDepCollectorPP::addOneModuleDep(const Module *M, const ModuleID ID,
ModuleDeps &MD) {
- MD.ClangModuleDeps.push_back(ID);
+ MD.ClangModuleDeps.push_back(std::move(ID));
if (MD.IsInStableDirectories)
MD.IsInStableDirectories = MDC.ModularDeps[M]->IsInStableDirectories;
}
>From dfa989e9e0c093536c879a55c276f037fcde0c71 Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour
Date: Tue, 10 Jun 2025 23:41:04 -0700
Subject: [PATCH 2/2] Trigger Build
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Tooling][NFC] Use move to avoid copies of large objects (PR #143603)
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Shafik Yaghmour (shafik)
Changes
Static analysis flagged these cases in which can use std::move and avoid copies
of large objects.
---
Full diff: https://github.com/llvm/llvm-project/pull/143603.diff
1 Files Affected:
- (modified) clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp (+2-2)
``diff
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index 44a270d5f7b35..b1495163ccc24 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -657,7 +657,7 @@ void ModuleDepCollectorPP::moduleImport(SourceLocation
ImportLoc,
P1689ModuleInfo RequiredModule;
RequiredModule.ModuleName = Path[0].getIdentifierInfo()->getName().str();
RequiredModule.Type = P1689ModuleInfo::ModuleType::NamedCXXModule;
-MDC.RequiredStdCXXModules.push_back(RequiredModule);
+MDC.RequiredStdCXXModules.push_back(std::move(RequiredModule));
return;
}
@@ -920,7 +920,7 @@ void ModuleDepCollectorPP::addAllSubmoduleDeps(
void ModuleDepCollectorPP::addOneModuleDep(const Module *M, const ModuleID ID,
ModuleDeps &MD) {
- MD.ClangModuleDeps.push_back(ID);
+ MD.ClangModuleDeps.push_back(std::move(ID));
if (MD.IsInStableDirectories)
MD.IsInStableDirectories = MDC.ModularDeps[M]->IsInStableDirectories;
}
``
https://github.com/llvm/llvm-project/pull/143603
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Tooling][NFC] Use move to avoid copies of large objects (PR #143603)
https://github.com/shafik created
https://github.com/llvm/llvm-project/pull/143603
Static analysis flagged these cases in which can use std::move and avoid copies
of large objects.
>From 6bcbd5e1691edd4cbc36bd0c318cdd3b526db1c3 Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour
Date: Tue, 10 Jun 2025 13:51:19 -0700
Subject: [PATCH] [Clang][Tooling][NFC] Use move to avoid copies of large
objects
Static analysis flagged these cases in which can use std::move and avoid copies
of large objects.
---
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index 44a270d5f7b35..b1495163ccc24 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -657,7 +657,7 @@ void ModuleDepCollectorPP::moduleImport(SourceLocation
ImportLoc,
P1689ModuleInfo RequiredModule;
RequiredModule.ModuleName = Path[0].getIdentifierInfo()->getName().str();
RequiredModule.Type = P1689ModuleInfo::ModuleType::NamedCXXModule;
-MDC.RequiredStdCXXModules.push_back(RequiredModule);
+MDC.RequiredStdCXXModules.push_back(std::move(RequiredModule));
return;
}
@@ -920,7 +920,7 @@ void ModuleDepCollectorPP::addAllSubmoduleDeps(
void ModuleDepCollectorPP::addOneModuleDep(const Module *M, const ModuleID ID,
ModuleDeps &MD) {
- MD.ClangModuleDeps.push_back(ID);
+ MD.ClangModuleDeps.push_back(std::move(ID));
if (MD.IsInStableDirectories)
MD.IsInStableDirectories = MDC.ModularDeps[M]->IsInStableDirectories;
}
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
