Skip to content

Commit 382209d

Browse files
committed
[llvm] manual fix-ups to IDS codemod of Object and ObjCopy libraries
1 parent 4a23006 commit 382209d

File tree

8 files changed

+28
-13
lines changed

8 files changed

+28
-13
lines changed

llvm/include/llvm/ObjCopy/COFF/COFFObjcopy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef LLVM_OBJCOPY_COFF_COFFOBJCOPY_H
1010
#define LLVM_OBJCOPY_COFF_COFFOBJCOPY_H
1111

12+
#include "llvm/Support/Compiler.h"
13+
1214
namespace llvm {
1315
class Error;
1416
class raw_ostream;

llvm/include/llvm/ObjCopy/ELF/ELFObjcopy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef LLVM_OBJCOPY_ELF_ELFOBJCOPY_H
1010
#define LLVM_OBJCOPY_ELF_ELFOBJCOPY_H
1111

12+
#include "llvm/Support/Compiler.h"
13+
1214
namespace llvm {
1315
class Error;
1416
class MemoryBuffer;

llvm/include/llvm/ObjCopy/MachO/MachOObjcopy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef LLVM_OBJCOPY_MACHO_MACHOOBJCOPY_H
1010
#define LLVM_OBJCOPY_MACHO_MACHOOBJCOPY_H
1111

12+
#include "llvm/Support/Compiler.h"
13+
1214
namespace llvm {
1315
class Error;
1416
class raw_ostream;

llvm/include/llvm/ObjCopy/wasm/WasmObjcopy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef LLVM_OBJCOPY_WASM_WASMOBJCOPY_H
1010
#define LLVM_OBJCOPY_WASM_WASMOBJCOPY_H
1111

12+
#include "llvm/Support/Compiler.h"
13+
1214
namespace llvm {
1315
class Error;
1416
class raw_ostream;

llvm/include/llvm/Object/Archive.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class AbstractArchiveMemberHeader {
7575
};
7676

7777
template <typename T>
78-
class CommonArchiveMemberHeader : public AbstractArchiveMemberHeader {
78+
class LLVM_ABI CommonArchiveMemberHeader : public AbstractArchiveMemberHeader {
7979
public:
8080
CommonArchiveMemberHeader(const Archive *Parent, const T *RawHeaderPtr)
8181
: AbstractArchiveMemberHeader(Parent), ArMemHdr(RawHeaderPtr){};
@@ -332,6 +332,10 @@ class LLVM_ABI Archive : public Binary {
332332
Archive(MemoryBufferRef Source, Error &Err);
333333
static Expected<std::unique_ptr<Archive>> create(MemoryBufferRef Source);
334334

335+
// Explicitly non-copyable.
336+
Archive(Archive const&) = delete;
337+
Archive& operator=(Archive const&) = delete;
338+
335339
/// Size field is 10 decimal digits long
336340
static const uint64_t MaxMemberSize = 9999999999;
337341

llvm/include/llvm/Object/ELF.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ class ELFFile {
256256
public:
257257
LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
258258

259+
// Default ctor required to instantiate the template for DLL export.
260+
ELFFile(const ELFFile&) = default;
261+
259262
// This is a callback that can be passed to a number of functions.
260263
// It can be used to ignore non-critical errors (warnings), which is
261264
// useful for dumpers, like llvm-readobj.

llvm/include/llvm/Object/XCOFFObjectFile.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ template <typename T> struct XCOFFSectionHeader {
176176
// Explicit extern template declarations.
177177
struct XCOFFSectionHeader32;
178178
struct XCOFFSectionHeader64;
179-
extern template struct XCOFFSectionHeader<XCOFFSectionHeader32>;
180-
extern template struct XCOFFSectionHeader<XCOFFSectionHeader64>;
179+
extern template struct LLVM_TEMPLATE_ABI XCOFFSectionHeader<XCOFFSectionHeader32>;
180+
extern template struct LLVM_TEMPLATE_ABI XCOFFSectionHeader<XCOFFSectionHeader64>;
181181

182182
struct XCOFFSectionHeader32 : XCOFFSectionHeader<XCOFFSectionHeader32> {
183183
char Name[XCOFF::NameSize];
@@ -318,8 +318,8 @@ typedef ExceptionSectionEntry<support::ubig32_t> ExceptionSectionEntry32;
318318
typedef ExceptionSectionEntry<support::ubig64_t> ExceptionSectionEntry64;
319319

320320
// Explicit extern template declarations.
321-
extern template struct ExceptionSectionEntry<support::ubig32_t>;
322-
extern template struct ExceptionSectionEntry<support::ubig64_t>;
321+
extern template struct LLVM_TEMPLATE_ABI ExceptionSectionEntry<support::ubig32_t>;
322+
extern template struct LLVM_TEMPLATE_ABI ExceptionSectionEntry<support::ubig64_t>;
323323

324324
struct XCOFFStringTable {
325325
uint32_t Size;
@@ -521,8 +521,8 @@ template <typename AddressType> struct XCOFFRelocation {
521521
uint8_t getRelocatedLength() const;
522522
};
523523

524-
extern template struct XCOFFRelocation<llvm::support::ubig32_t>;
525-
extern template struct XCOFFRelocation<llvm::support::ubig64_t>;
524+
extern template struct LLVM_TEMPLATE_ABI XCOFFRelocation<llvm::support::ubig32_t>;
525+
extern template struct LLVM_TEMPLATE_ABI XCOFFRelocation<llvm::support::ubig64_t>;
526526

527527
struct XCOFFRelocation32 : XCOFFRelocation<llvm::support::ubig32_t> {};
528528
struct XCOFFRelocation64 : XCOFFRelocation<llvm::support::ubig64_t> {};

llvm/lib/Object/XCOFFObjectFile.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ uint8_t XCOFFRelocation<AddressType>::getRelocatedLength() const {
9393
return (Info & XR_BIASED_LENGTH_MASK) + 1;
9494
}
9595

96-
template struct ExceptionSectionEntry<support::ubig32_t>;
97-
template struct ExceptionSectionEntry<support::ubig64_t>;
96+
template struct LLVM_EXPORT_TEMPLATE ExceptionSectionEntry<support::ubig32_t>;
97+
template struct LLVM_EXPORT_TEMPLATE ExceptionSectionEntry<support::ubig64_t>;
9898

9999
template <typename T>
100100
Expected<StringRef> getLoaderSecSymNameInStrTbl(const T *LoaderSecHeader,
@@ -1375,11 +1375,11 @@ Expected<StringRef> XCOFFSymbolRef::getName() const {
13751375
}
13761376

13771377
// Explicitly instantiate template classes.
1378-
template struct XCOFFSectionHeader<XCOFFSectionHeader32>;
1379-
template struct XCOFFSectionHeader<XCOFFSectionHeader64>;
1378+
template struct LLVM_EXPORT_TEMPLATE XCOFFSectionHeader<XCOFFSectionHeader32>;
1379+
template struct LLVM_EXPORT_TEMPLATE XCOFFSectionHeader<XCOFFSectionHeader64>;
13801380

1381-
template struct XCOFFRelocation<llvm::support::ubig32_t>;
1382-
template struct XCOFFRelocation<llvm::support::ubig64_t>;
1381+
template struct LLVM_EXPORT_TEMPLATE XCOFFRelocation<llvm::support::ubig32_t>;
1382+
template struct LLVM_EXPORT_TEMPLATE XCOFFRelocation<llvm::support::ubig64_t>;
13831383

13841384
template LLVM_EXPORT_TEMPLATE
13851385
llvm::Expected<llvm::ArrayRef<llvm::object::XCOFFRelocation64>>

0 commit comments

Comments
 (0)