summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/File.h
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@gmail.com>2014-02-02 19:34:55 +0000
committerJoey Gouly <joey.gouly@gmail.com>2014-02-02 19:34:55 +0000
commitcf466800b70f4bfa4fed964f645662f850443de8 (patch)
treeafae7c0db89c914ae8678cd288b19c73278f0994 /lld/lib/ReaderWriter/MachO/File.h
parentcc8068f2ac84c8c40b327775292bacf31c6384d0 (diff)
downloadbcm5719-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.h12
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;
};
OpenPOWER on IntegriCloud