Reapply [FastISel][AArch64] Make use of the zero register when possible (r215591).
[oota-llvm.git] / lib / DebugInfo / DWARFUnit.cpp
index 4ec3bdd5823a28cc981640f401276958d4b5cbfb..6ed3e04b7bf304c2f42e3851f2d10acfa7949507 100644 (file)
@@ -235,9 +235,10 @@ size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
   return DieArray.size();
 }
 
-DWARFUnit::DWOHolder::DWOHolder(object::ObjectFile *DWOFile)
-    : DWOFile(DWOFile),
-      DWOContext(cast<DWARFContext>(DIContext::getDWARFContext(DWOFile))),
+DWARFUnit::DWOHolder::DWOHolder(std::unique_ptr<object::ObjectFile> DWOFile)
+    : DWOFile(std::move(DWOFile)),
+      DWOContext(
+          cast<DWARFContext>(DIContext::getDWARFContext(*this->DWOFile))),
       DWOU(nullptr) {
   if (DWOContext->getNumDWOCompileUnits() > 0)
     DWOU = DWOContext->getDWOCompileUnitAtIndex(0);
@@ -260,12 +261,12 @@ bool DWARFUnit::parseDWO() {
     sys::path::append(AbsolutePath, CompilationDir);
   }
   sys::path::append(AbsolutePath, DWOFileName);
-  ErrorOr<std::unique_ptr<object::ObjectFile>> DWOFile =
+  ErrorOr<object::OwningBinary<object::ObjectFile>> DWOFile =
       object::ObjectFile::createObjectFile(AbsolutePath);
   if (!DWOFile)
     return false;
   // Reset DWOHolder.
-  DWO.reset(new DWOHolder(DWOFile.get().get()));
+  DWO = llvm::make_unique<DWOHolder>(std::move(DWOFile->getBinary()));
   DWARFUnit *DWOCU = DWO->getUnit();
   // Verify that compile unit in .dwo file is valid.
   if (!DWOCU || DWOCU->getDWOId() != getDWOId()) {