Revert "R600: Add missing file to CMakeLists.txt"
[oota-llvm.git] / lib / DebugInfo / DWARFContext.cpp
index 39799f0b235ae7d0bdbb0c2573614911e10f13fa..aa86f6aac0312b47bad723460d8d1dde69c177f5 100644 (file)
@@ -314,7 +314,7 @@ DWARFContext::getLineTableForUnit(DWARFUnit *cu) {
 }
 
 void DWARFContext::parseCompileUnits() {
-  CUs.parse(*this, getInfoSection().Data, getInfoSection().Relocs);
+  CUs.parse(*this, getInfoSection());
 }
 
 void DWARFContext::parseTypeUnits() {
@@ -322,12 +322,12 @@ void DWARFContext::parseTypeUnits() {
     return;
   for (const auto &I : getTypesSections()) {
     TUs.push_back(DWARFUnitSection<DWARFTypeUnit>());
-    TUs.back().parse(*this, I.second.Data, I.second.Relocs);
+    TUs.back().parse(*this, I.second);
   }
 }
 
 void DWARFContext::parseDWOCompileUnits() {
-  DWOCUs.parseDWO(*this, getInfoDWOSection().Data, getInfoDWOSection().Relocs);
+  DWOCUs.parseDWO(*this, getInfoDWOSection());
 }
 
 void DWARFContext::parseDWOTypeUnits() {
@@ -335,7 +335,7 @@ void DWARFContext::parseDWOTypeUnits() {
     return;
   for (const auto &I : getTypesDWOSections()) {
     DWOTUs.push_back(DWARFUnitSection<DWARFTypeUnit>());
-    DWOTUs.back().parseDWO(*this, I.second.Data, I.second.Relocs);
+    DWOTUs.back().parseDWO(*this, I.second);
   }
 }
 
@@ -509,19 +509,17 @@ static bool consumeCompressedDebugSectionHeader(StringRef &data,
   return true;
 }
 
-DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile &Obj)
+DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj)
     : IsLittleEndian(Obj.isLittleEndian()),
       AddressSize(Obj.getBytesInAddress()) {
   for (const SectionRef &Section : Obj.sections()) {
     StringRef name;
     Section.getName(name);
     // Skip BSS and Virtual sections, they aren't interesting.
-    bool IsBSS;
-    Section.isBSS(IsBSS);
+    bool IsBSS = Section.isBSS();
     if (IsBSS)
       continue;
-    bool IsVirtual;
-    Section.isVirtual(IsVirtual);
+    bool IsVirtual = Section.isVirtual();
     if (IsVirtual)
       continue;
     StringRef data;
@@ -612,23 +610,19 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile &Obj)
     }
 
     if (Section.relocation_begin() != Section.relocation_end()) {
-      uint64_t SectionSize;
-      RelocatedSection->getSize(SectionSize);
+      uint64_t SectionSize = RelocatedSection->getSize();
       for (const RelocationRef &Reloc : Section.relocations()) {
         uint64_t Address;
         Reloc.getOffset(Address);
         uint64_t Type;
         Reloc.getType(Type);
         uint64_t SymAddr = 0;
-        // ELF relocations may need the symbol address
-        if (Obj.isELF()) {
-          object::symbol_iterator Sym = Reloc.getSymbol();
+        object::symbol_iterator Sym = Reloc.getSymbol();
+        if (Sym != Obj.symbol_end())
           Sym->getAddress(SymAddr);
-        }
 
-        object::RelocVisitor V(Obj.getFileFormatName());
-        // The section address is always 0 for debug sections.
-        object::RelocToApply R(V.visit(Type, Reloc, 0, SymAddr));
+        object::RelocVisitor V(Obj);
+        object::RelocToApply R(V.visit(Type, Reloc, SymAddr));
         if (V.error()) {
           SmallString<32> Name;
           std::error_code ec(Reloc.getTypeName(Name));