Skip to content

Commit 96bde11

Browse files
[TargetParser] Remove const from a return type (NFC) (#149255)
getHostCPUFeatures constructs and returns a temporary instance of StringMap<bool>. We don't need const on the return type.
1 parent 7fa48ce commit 96bde11

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

llvm/include/llvm/TargetParser/Host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ LLVM_ABI StringRef getHostCPUName();
5353
/// which features may appear in this map, except that they are all valid LLVM
5454
/// feature names. The map can be empty, for example if feature detection
5555
/// fails.
56-
LLVM_ABI const StringMap<bool, MallocAllocator> getHostCPUFeatures();
56+
LLVM_ABI StringMap<bool, MallocAllocator> getHostCPUFeatures();
5757

5858
/// This is a function compatible with cl::AddExtraVersionPrinter, which adds
5959
/// info about the current target triple and detected CPU.

llvm/lib/TargetParser/Host.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ VendorSignatures getVendorSignature(unsigned *MaxLeaf) {
18551855

18561856
#if defined(__i386__) || defined(_M_IX86) || \
18571857
defined(__x86_64__) || defined(_M_X64)
1858-
const StringMap<bool> sys::getHostCPUFeatures() {
1858+
StringMap<bool> sys::getHostCPUFeatures() {
18591859
unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0;
18601860
unsigned MaxLevel;
18611861
StringMap<bool> Features;
@@ -2068,7 +2068,7 @@ const StringMap<bool> sys::getHostCPUFeatures() {
20682068
return Features;
20692069
}
20702070
#elif defined(__linux__) && (defined(__arm__) || defined(__aarch64__))
2071-
const StringMap<bool> sys::getHostCPUFeatures() {
2071+
StringMap<bool> sys::getHostCPUFeatures() {
20722072
StringMap<bool> Features;
20732073
std::unique_ptr<llvm::MemoryBuffer> P = getProcCpuinfoContent();
20742074
if (!P)
@@ -2148,7 +2148,7 @@ const StringMap<bool> sys::getHostCPUFeatures() {
21482148
return Features;
21492149
}
21502150
#elif defined(_WIN32) && (defined(__aarch64__) || defined(_M_ARM64))
2151-
const StringMap<bool> sys::getHostCPUFeatures() {
2151+
StringMap<bool> sys::getHostCPUFeatures() {
21522152
StringMap<bool> Features;
21532153

21542154
// If we're asking the OS at runtime, believe what the OS says
@@ -2167,7 +2167,7 @@ const StringMap<bool> sys::getHostCPUFeatures() {
21672167
}
21682168
#elif defined(__linux__) && defined(__loongarch__)
21692169
#include <sys/auxv.h>
2170-
const StringMap<bool> sys::getHostCPUFeatures() {
2170+
StringMap<bool> sys::getHostCPUFeatures() {
21712171
unsigned long hwcap = getauxval(AT_HWCAP);
21722172
bool HasFPU = hwcap & (1UL << 3); // HWCAP_LOONGARCH_FPU
21732173
uint32_t cpucfg2 = 0x2, cpucfg3 = 0x3;
@@ -2196,7 +2196,7 @@ const StringMap<bool> sys::getHostCPUFeatures() {
21962196
return Features;
21972197
}
21982198
#elif defined(__linux__) && defined(__riscv)
2199-
const StringMap<bool> sys::getHostCPUFeatures() {
2199+
StringMap<bool> sys::getHostCPUFeatures() {
22002200
RISCVHwProbe Query[]{{/*RISCV_HWPROBE_KEY_BASE_BEHAVIOR=*/3, 0},
22012201
{/*RISCV_HWPROBE_KEY_IMA_EXT_0=*/4, 0},
22022202
{/*RISCV_HWPROBE_KEY_MISALIGNED_SCALAR_PERF=*/9, 0}};
@@ -2279,7 +2279,7 @@ const StringMap<bool> sys::getHostCPUFeatures() {
22792279
return Features;
22802280
}
22812281
#else
2282-
const StringMap<bool> sys::getHostCPUFeatures() { return {}; }
2282+
StringMap<bool> sys::getHostCPUFeatures() { return {}; }
22832283
#endif
22842284

22852285
#if __APPLE__

0 commit comments

Comments
 (0)