Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
llvm-svn: 216525
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index 0c2ec11..94e5b1e 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -783,8 +783,7 @@
== 0 && "Aux Symbol data did not point to the beginning of a symbol");
# endif
}
- return ArrayRef<uint8_t>(Aux,
- Symbol->NumberOfAuxSymbols * sizeof(coff_symbol));
+ return makeArrayRef(Aux, Symbol->NumberOfAuxSymbols * sizeof(coff_symbol));
}
std::error_code COFFObjectFile::getSectionName(const coff_section *Sec,
@@ -825,8 +824,8 @@
uintptr_t ConEnd = ConStart + Sec->SizeOfRawData;
if (ConEnd > uintptr_t(Data.getBufferEnd()))
return object_error::parse_failed;
- Res = ArrayRef<uint8_t>(reinterpret_cast<const unsigned char*>(ConStart),
- Sec->SizeOfRawData);
+ Res = makeArrayRef(reinterpret_cast<const uint8_t*>(ConStart),
+ Sec->SizeOfRawData);
return object_error::success;
}
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 746fd73..da968b5 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -1515,14 +1515,14 @@
MachOObjectFile::getSectionRawName(DataRefImpl Sec) const {
const section_base *Base =
reinterpret_cast<const section_base *>(Sections[Sec.d.a]);
- return ArrayRef<char>(Base->sectname);
+ return makeArrayRef(Base->sectname);
}
ArrayRef<char>
MachOObjectFile::getSectionRawFinalSegmentName(DataRefImpl Sec) const {
const section_base *Base =
reinterpret_cast<const section_base *>(Sections[Sec.d.a]);
- return ArrayRef<char>(Base->segname);
+ return makeArrayRef(Base->segname);
}
bool