forked from OSchip/llvm-project
				
			[mach-o] fix struct initialization to work with Windows compiler
llvm-svn: 211951
This commit is contained in:
		
							parent
							
								
									7f15ce03af
								
							
						
					
					
						commit
						07d2c313a9
					
				| 
						 | 
					@ -40,8 +40,7 @@ public:
 | 
				
			||||||
    MachODefinedAtom *atom =
 | 
					    MachODefinedAtom *atom =
 | 
				
			||||||
        new (_allocator) MachODefinedAtom(*this, name, scope, type, merge,
 | 
					        new (_allocator) MachODefinedAtom(*this, name, scope, type, merge,
 | 
				
			||||||
                                          content);
 | 
					                                          content);
 | 
				
			||||||
    addAtom(*atom);
 | 
					    addAtomForSection(inSection, atom, sectionOffset);
 | 
				
			||||||
    _sectionAtoms[inSection].push_back({sectionOffset, atom});
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void addDefinedAtomInCustomSection(StringRef name, Atom::Scope scope,
 | 
					  void addDefinedAtomInCustomSection(StringRef name, Atom::Scope scope,
 | 
				
			||||||
| 
						 | 
					@ -61,8 +60,7 @@ public:
 | 
				
			||||||
    MachODefinedCustomSectionAtom *atom =
 | 
					    MachODefinedCustomSectionAtom *atom =
 | 
				
			||||||
        new (_allocator) MachODefinedCustomSectionAtom(*this, name, scope, type, 
 | 
					        new (_allocator) MachODefinedCustomSectionAtom(*this, name, scope, type, 
 | 
				
			||||||
                                                  merge, content, sectionName);
 | 
					                                                  merge, content, sectionName);
 | 
				
			||||||
    addAtom(*atom);
 | 
					    addAtomForSection(inSection, atom, sectionOffset);
 | 
				
			||||||
    _sectionAtoms[inSection].push_back({sectionOffset, atom});
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void addZeroFillDefinedAtom(StringRef name, Atom::Scope scope,
 | 
					  void addZeroFillDefinedAtom(StringRef name, Atom::Scope scope,
 | 
				
			||||||
| 
						 | 
					@ -74,8 +72,7 @@ public:
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    MachODefinedAtom *atom =
 | 
					    MachODefinedAtom *atom =
 | 
				
			||||||
        new (_allocator) MachODefinedAtom(*this, name, scope, size);
 | 
					        new (_allocator) MachODefinedAtom(*this, name, scope, size);
 | 
				
			||||||
    addAtom(*atom);
 | 
					    addAtomForSection(inSection, atom, sectionOffset);
 | 
				
			||||||
    _sectionAtoms[inSection].push_back({sectionOffset, atom});
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void addUndefinedAtom(StringRef name, bool copyRefs) {
 | 
					  void addUndefinedAtom(StringRef name, bool copyRefs) {
 | 
				
			||||||
| 
						 | 
					@ -139,6 +136,17 @@ public:
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  struct SectionOffsetAndAtom { uint64_t offset;  MachODefinedAtom *atom; };
 | 
					  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 *, 
 | 
					  typedef llvm::DenseMap<const normalized::Section *, 
 | 
				
			||||||
                         std::vector<SectionOffsetAndAtom>>  SectionToAtoms;
 | 
					                         std::vector<SectionOffsetAndAtom>>  SectionToAtoms;
 | 
				
			||||||
  typedef llvm::StringMap<const lld::Atom *> NameToAtom;
 | 
					  typedef llvm::StringMap<const lld::Atom *> NameToAtom;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue