[mach-o] fix struct initialization to work with Windows compiler

llvm-svn: 211951
This commit is contained in:
Nick Kledzik 2014-06-27 19:08:56 +00:00
parent 7f15ce03af
commit 07d2c313a9
1 changed files with 14 additions and 6 deletions

View File

@ -40,8 +40,7 @@ public:
MachODefinedAtom *atom =
new (_allocator) MachODefinedAtom(*this, name, scope, type, merge,
content);
addAtom(*atom);
_sectionAtoms[inSection].push_back({sectionOffset, atom});
addAtomForSection(inSection, atom, sectionOffset);
}
void addDefinedAtomInCustomSection(StringRef name, Atom::Scope scope,
@ -61,8 +60,7 @@ public:
MachODefinedCustomSectionAtom *atom =
new (_allocator) MachODefinedCustomSectionAtom(*this, name, scope, type,
merge, content, sectionName);
addAtom(*atom);
_sectionAtoms[inSection].push_back({sectionOffset, atom});
addAtomForSection(inSection, atom, sectionOffset);
}
void addZeroFillDefinedAtom(StringRef name, Atom::Scope scope,
@ -74,8 +72,7 @@ public:
}
MachODefinedAtom *atom =
new (_allocator) MachODefinedAtom(*this, name, scope, size);
addAtom(*atom);
_sectionAtoms[inSection].push_back({sectionOffset, atom});
addAtomForSection(inSection, atom, sectionOffset);
}
void addUndefinedAtom(StringRef name, bool copyRefs) {
@ -139,6 +136,17 @@ public:
private:
struct SectionOffsetAndAtom { uint64_t offset; MachODefinedAtom *atom; };
void addAtomForSection(const Section *inSection, MachODefinedAtom* atom,
uint64_t sectionOffset) {
SectionOffsetAndAtom offAndAtom;
offAndAtom.offset = sectionOffset;
offAndAtom.atom = atom;
_sectionAtoms[inSection].push_back(offAndAtom);
addAtom(*atom);
}
typedef llvm::DenseMap<const normalized::Section *,
std::vector<SectionOffsetAndAtom>> SectionToAtoms;
typedef llvm::StringMap<const lld::Atom *> NameToAtom;