1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[Support] Stop passing StringRefs by const reference in some of the getHostCPUname implementations. NFC

llvm-svn: 326916
This commit is contained in:
Craig Topper 2018-03-07 17:53:16 +00:00
parent 71647c0d9d
commit e9bba73c86
2 changed files with 9 additions and 12 deletions

View File

@ -88,9 +88,9 @@ constexpr bool IsBigEndianHost = false;
namespace detail {
/// Helper functions to extract HostCPUName from /proc/cpuinfo on linux.
StringRef getHostCPUNameForPowerPC(const StringRef &ProcCpuinfoContent);
StringRef getHostCPUNameForARM(const StringRef &ProcCpuinfoContent);
StringRef getHostCPUNameForS390x(const StringRef &ProcCpuinfoContent);
StringRef getHostCPUNameForPowerPC(StringRef ProcCpuinfoContent);
StringRef getHostCPUNameForARM(StringRef ProcCpuinfoContent);
StringRef getHostCPUNameForS390x(StringRef ProcCpuinfoContent);
StringRef getHostCPUNameForBPF();
}
}

View File

@ -65,8 +65,7 @@ static std::unique_ptr<llvm::MemoryBuffer>
return std::move(*Text);
}
StringRef sys::detail::getHostCPUNameForPowerPC(
const StringRef &ProcCpuinfoContent) {
StringRef sys::detail::getHostCPUNameForPowerPC(StringRef ProcCpuinfoContent) {
// Access to the Processor Version Register (PVR) on PowerPC is privileged,
// and so we must use an operating-system interface to determine the current
// processor type. On Linux, this is exposed through the /proc/cpuinfo file.
@ -145,8 +144,7 @@ StringRef sys::detail::getHostCPUNameForPowerPC(
.Default(generic);
}
StringRef sys::detail::getHostCPUNameForARM(
const StringRef &ProcCpuinfoContent) {
StringRef sys::detail::getHostCPUNameForARM(StringRef ProcCpuinfoContent) {
// The cpuid register on arm is not accessible from user space. On Linux,
// it is exposed through the /proc/cpuinfo file.
@ -250,8 +248,7 @@ StringRef sys::detail::getHostCPUNameForARM(
return "generic";
}
StringRef sys::detail::getHostCPUNameForS390x(
const StringRef &ProcCpuinfoContent) {
StringRef sys::detail::getHostCPUNameForS390x(StringRef ProcCpuinfoContent) {
// STIDP is a privileged operation, so use /proc/cpuinfo instead.
// The "processor 0:" line comes after a fair amount of other information,
@ -1062,19 +1059,19 @@ StringRef sys::getHostCPUName() {
#elif defined(__linux__) && (defined(__ppc__) || defined(__powerpc__))
StringRef sys::getHostCPUName() {
std::unique_ptr<llvm::MemoryBuffer> P = getProcCpuinfoContent();
const StringRef& Content = P ? P->getBuffer() : "";
StringRef Content = P ? P->getBuffer() : "";
return detail::getHostCPUNameForPowerPC(Content);
}
#elif defined(__linux__) && (defined(__arm__) || defined(__aarch64__))
StringRef sys::getHostCPUName() {
std::unique_ptr<llvm::MemoryBuffer> P = getProcCpuinfoContent();
const StringRef& Content = P ? P->getBuffer() : "";
StringRef Content = P ? P->getBuffer() : "";
return detail::getHostCPUNameForARM(Content);
}
#elif defined(__linux__) && defined(__s390x__)
StringRef sys::getHostCPUName() {
std::unique_ptr<llvm::MemoryBuffer> P = getProcCpuinfoContent();
const StringRef& Content = P ? P->getBuffer() : "";
StringRef Content = P ? P->getBuffer() : "";
return detail::getHostCPUNameForS390x(Content);
}
#else