diff options
author | Joey Gouly <joey.gouly@gmail.com> | 2014-02-02 19:34:55 +0000 |
---|---|---|
committer | Joey Gouly <joey.gouly@gmail.com> | 2014-02-02 19:34:55 +0000 |
commit | cf466800b70f4bfa4fed964f645662f850443de8 (patch) | |
tree | afae7c0db89c914ae8678cd288b19c73278f0994 /lld/lib/ReaderWriter/MachO/File.h | |
parent | cc8068f2ac84c8c40b327775292bacf31c6384d0 (diff) | |
download | bcm5719-llvm-cf466800b70f4bfa4fed964f645662f850443de8.tar.gz bcm5719-llvm-cf466800b70f4bfa4fed964f645662f850443de8.zip |
[MachO] Add undefined atoms.
llvm-svn: 200649
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/File.h')
-rw-r--r-- | lld/lib/ReaderWriter/MachO/File.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/MachO/File.h b/lld/lib/ReaderWriter/MachO/File.h index 697c2e4d144..f67e3f4db80 100644 --- a/lld/lib/ReaderWriter/MachO/File.h +++ b/lld/lib/ReaderWriter/MachO/File.h @@ -37,6 +37,18 @@ public: addAtom(*atom); } + void addUndefinedAtom(StringRef name, bool copyRefs) { + if (copyRefs) { + // Make a copy of the atom's name and content that is owned by this file. + char *s = _allocator.Allocate<char>(name.size()); + memcpy(s, name.data(), name.size()); + name = StringRef(s, name.size()); + } + SimpleUndefinedAtom *atom = + new (_allocator) SimpleUndefinedAtom(*this, name); + addAtom(*atom); + } + private: llvm::BumpPtrAllocator _allocator; }; |