[clang] aeda856 - [clang][modules-driver] Apply rule-of-five to CompilationGraph types (NFC) (#191430)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 10 08:12:48 PDT 2026
Author: Naveen Seth Hanig
Date: 2026-04-10T17:12:42+02:00
New Revision: aeda856d2fafcbc969979abfb88010ce0fe90452
URL: https://github.com/llvm/llvm-project/commit/aeda856d2fafcbc969979abfb88010ce0fe90452
DIFF: https://github.com/llvm/llvm-project/commit/aeda856d2fafcbc969979abfb88010ce0fe90452.diff
LOG: [clang][modules-driver] Apply rule-of-five to CompilationGraph types (NFC) (#191430)
CompilationGraph owns all nodes and edges via `unique_ptr`, but exposes
pointers to the underlying objects. Make them non-movable to maintain
stable addresses.
Make them non-copyable since we don't want to copy `Command` objects
they hold or create duplicate root nodes.
Apply full rule-of-five to `CompilationGraph`.
Added:
Modified:
clang/lib/Driver/ModulesDriver.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ModulesDriver.cpp b/clang/lib/Driver/ModulesDriver.cpp
index 783f2270c4e0f..afccdb104796a 100644
--- a/clang/lib/Driver/ModulesDriver.cpp
+++ b/clang/lib/Driver/ModulesDriver.cpp
@@ -749,6 +749,8 @@ class CGNode : public CGNodeBase {
CGNode(const NodeKind K) : Kind(K) {}
CGNode(const CGNode &) = delete;
CGNode(CGNode &&) = delete;
+ CGNode &operator=(const CGNode &) = delete;
+ CGNode &operator=(CGNode &&) = delete;
virtual ~CGNode() = 0;
NodeKind getKind() const { return Kind; }
@@ -893,6 +895,10 @@ class CGEdge : public CGEdgeBase {
};
CGEdge(CGNode &N, EdgeKind K) : CGEdgeBase(N), Kind(K) {}
+ CGEdge(const CGEdge &) = delete;
+ CGEdge &operator=(const CGEdge &) = delete;
+ CGEdge(CGEdge &&) = delete;
+ CGEdge &operator=(CGEdge &&) = delete;
EdgeKind getKind() const { return Kind; }
@@ -909,7 +915,10 @@ class CompilationGraph : public CGBase {
public:
CompilationGraph() = default;
CompilationGraph(const CompilationGraph &) = delete;
+ CompilationGraph &operator=(const CompilationGraph &) = delete;
CompilationGraph(CompilationGraph &&G) = default;
+ CompilationGraph &operator=(CompilationGraph &&) = default;
+ ~CompilationGraph() = default;
CGNode &getRoot() const {
assert(Root && "Root node has not yet been created!");
More information about the cfe-commits
mailing list