[JITLink] Delete copy and move constructors for jitlink::Section.
authorLang Hames <lhames@gmail.com>
Wed, 31 Mar 2021 05:56:41 +0000 (22:56 -0700)
committerLang Hames <lhames@gmail.com>
Wed, 31 Mar 2021 05:58:14 +0000 (22:58 -0700)
Sections are not movable or copyable.

llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp

index 646cc4c..f25bad6 100644 (file)
@@ -590,6 +590,12 @@ public:
 
   ~Section();
 
+  // Sections are not movable or copyable.
+  Section(const Section &) = delete;
+  Section &operator=(const Section &) = delete;
+  Section(Section &&) = delete;
+  Section &operator=(Section &&) = delete;
+
   /// Returns the name of this section.
   StringRef getName() const { return Name; }
 
index a60a04e..4685193 100644 (file)
@@ -42,7 +42,7 @@ TEST(LinkGraphTest, AddressAccess) {
   LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
               getGenericEdgeKindName);
 
-  auto Sec1 = G.createSection("__data.1", RWFlags);
+  auto &Sec1 = G.createSection("__data.1", RWFlags);
   auto &B1 = G.createContentBlock(Sec1, BlockContent, 0x1000, 8, 0);
   auto &S1 = G.addDefinedSymbol(B1, 4, "S1", 4, Linkage::Strong, Scope::Default,
                                 false, false);