[llvm] Set ObjectFile's assignment operator to also be deleted like its copy constructor (PR #92942)

Thomas Fransham via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 13:57:36 PDT 2024


https://github.com/fsfod updated https://github.com/llvm/llvm-project/pull/92942

>From ea6d97295a3ff34091bd696bcc344f761bd18cc6 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Tue, 21 May 2024 17:29:31 +0100
Subject: [PATCH 1/3] Set ObjectFile's assignment operator to also be deleted
 like its copy ctor

This will also fix a warning when ObjectFile is dllexport'ed on Windows.
---
 llvm/include/llvm/Object/ObjectFile.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/include/llvm/Object/ObjectFile.h b/llvm/include/llvm/Object/ObjectFile.h
index 8c868c7643edc..645829d944d9f 100644
--- a/llvm/include/llvm/Object/ObjectFile.h
+++ b/llvm/include/llvm/Object/ObjectFile.h
@@ -302,6 +302,7 @@ class ObjectFile : public SymbolicFile {
 public:
   ObjectFile() = delete;
   ObjectFile(const ObjectFile &other) = delete;
+  ObjectFile operator=(const ObjectFile &other) = delete;
 
   uint64_t getCommonSymbolSize(DataRefImpl Symb) const {
     Expected<uint32_t> SymbolFlagsOrErr = getSymbolFlags(Symb);

>From 61b90212b001cbeea9224a0e7cbfe789ae3cd988 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Tue, 21 May 2024 19:28:00 +0100
Subject: [PATCH 2/3] fix declaration of assignment operator

---
 llvm/include/llvm/Object/ObjectFile.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/Object/ObjectFile.h b/llvm/include/llvm/Object/ObjectFile.h
index 645829d944d9f..9f60f29262402 100644
--- a/llvm/include/llvm/Object/ObjectFile.h
+++ b/llvm/include/llvm/Object/ObjectFile.h
@@ -302,7 +302,7 @@ class ObjectFile : public SymbolicFile {
 public:
   ObjectFile() = delete;
   ObjectFile(const ObjectFile &other) = delete;
-  ObjectFile operator=(const ObjectFile &other) = delete;
+  ObjectFile &opeartor=(const ObjectFile &other) = delete;
 
   uint64_t getCommonSymbolSize(DataRefImpl Symb) const {
     Expected<uint32_t> SymbolFlagsOrErr = getSymbolFlags(Symb);

>From 97a497097bc14e679d2b467999b88ccae23269d7 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Tue, 21 May 2024 21:57:02 +0100
Subject: [PATCH 3/3] run clang format

---
 llvm/include/llvm/Object/ObjectFile.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/Object/ObjectFile.h b/llvm/include/llvm/Object/ObjectFile.h
index 9f60f29262402..a50766ccaeb89 100644
--- a/llvm/include/llvm/Object/ObjectFile.h
+++ b/llvm/include/llvm/Object/ObjectFile.h
@@ -302,7 +302,7 @@ class ObjectFile : public SymbolicFile {
 public:
   ObjectFile() = delete;
   ObjectFile(const ObjectFile &other) = delete;
-  ObjectFile &opeartor=(const ObjectFile &other) = delete;
+  ObjectFile &opeartor = (const ObjectFile &other) = delete;
 
   uint64_t getCommonSymbolSize(DataRefImpl Symb) const {
     Expected<uint32_t> SymbolFlagsOrErr = getSymbolFlags(Symb);



More information about the llvm-commits mailing list