llvm.org GIT mirror llvm / d897ffb
Revert "Make naming in Host.h in line with coding standards." This reverts r299062, which caused build failures on Windows. It also reverts the attempts to fix the windows builds in r299064 and r299065. The introduction of namespace llvm::sys::detail makes MSVC, and seemingly also mingw, complain about ambiguity with the existing namespace llvm::detail. E.g.: C:\b\slave\sanitizer-windows\llvm\include\llvm/Support/MathExtras.h(184): error C2872: 'detail': ambiguous symbol C:\b\slave\sanitizer-windows\llvm\include\llvm/Support/PointerLikeTypeTraits.h(31): note: could be 'llvm::detail' C:\b\slave\sanitizer-windows\llvm\include\llvm/Support/Host.h(80): note: or 'llvm::sys::detail' In r299064 and r299065 I tried to fix these ambiguities, based on the errors reported in the log files. It seems however that the build stops early when this kind of error is encountered, and many build-then-fix-iterations on Windows may be needed to fix this. Therefore reverting r299062 for now to get the build working again on Windows. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299066 91177308-0d34-0410-b5e6-96231b3b80d8 Kristof Beyls 3 years ago
7 changed file(s) with 56 addition(s) and 56 deletion(s). Raw diff Collapse all Expand all
178178 void erase(ConstIterator CI) { return TheMap.erase(CI.I); }
179179
180180 std::pair insert(const ValueT &V) {
181 llvm::detail::DenseSetEmpty Empty;
181 detail::DenseSetEmpty Empty;
182182 return TheMap.try_emplace(V, Empty);
183183 }
184184
185185 std::pair insert(ValueT &&V) {
186 llvm::detail::DenseSetEmpty Empty;
186 detail::DenseSetEmpty Empty;
187187 return TheMap.try_emplace(std::move(V), Empty);
188188 }
189189
192192 template
193193 std::pair insert_as(const ValueT &V,
194194 const LookupKeyT &LookupKey) {
195 return TheMap.insert_as({V, llvm::detail::DenseSetEmpty()}, LookupKey);
195 return TheMap.insert_as({V, detail::DenseSetEmpty()}, LookupKey);
196196 }
197197 template
198198 std::pair insert_as(ValueT &&V, const LookupKeyT &LookupKey) {
199 return TheMap.insert_as({std::move(V), llvm::detail::DenseSetEmpty()},
200 LookupKey);
199 return TheMap.insert_as({std::move(V), detail::DenseSetEmpty()}, LookupKey);
201200 }
202201
203202 // Range insertion of values.
212211
213212 /// Implements a dense probed hash-table based set.
214213 template >
215 class DenseSet
216 : public llvm::detail::DenseSetImpl<
217 ValueT, DenseMap
218 llvm::detail::DenseSetPair>,
219 ValueInfoT> {
220 using BaseT = llvm::detail::DenseSetImpl<
221 ValueT, DenseMap
222 llvm::detail::DenseSetPair>,
223 ValueInfoT>;
214 class DenseSet : public detail::DenseSetImpl<
215 ValueT, DenseMap
216 detail::DenseSetPair>,
217 ValueInfoT> {
218 using BaseT =
219 detail::DenseSetImpl
220 DenseMap
221 detail::DenseSetPair>,
222 ValueInfoT>;
224223
225224 public:
226225 using BaseT::BaseT;
231230 template
232231 typename ValueInfoT = DenseMapInfo>
233232 class SmallDenseSet
234 : public llvm::detail::DenseSetImpl<
235 ValueT,
236 SmallDenseMap
237 ValueInfoT, llvm::detail::DenseSetPair>,
233 : public detail::DenseSetImpl<
234 ValueT, SmallDenseMap
235 ValueInfoT, detail::DenseSetPair>,
238236 ValueInfoT> {
239 using BaseT = llvm::detail::DenseSetImpl<
240 ValueT, SmallDenseMap
241 ValueInfoT, llvm::detail::DenseSetPair>,
237 using BaseT = detail::DenseSetImpl<
238 ValueT, SmallDenseMap
239 ValueInfoT, detail::DenseSetPair>,
242240 ValueInfoT>;
243241
244242 public:
230230 template
231231 inline std::string join(IteratorT Begin, IteratorT End, StringRef Separator) {
232232 typedef typename std::iterator_traits::iterator_category tag;
233 return llvm::detail::join_impl(Begin, End, Separator, tag());
233 return detail::join_impl(Begin, End, Separator, tag());
234234 }
235235
236236 /// Joins the strings in the range [R.begin(), R.end()), adding Separator
250250 if (sizeof...(Items) == 0)
251251 return Result;
252252
253 size_t NS = llvm::detail::join_one_item_size(Separator);
254 size_t NI = llvm::detail::join_items_size(std::forward(Items)...);
253 size_t NS = detail::join_one_item_size(Separator);
254 size_t NI = detail::join_items_size(std::forward(Items)...);
255255 Result.reserve(NI + (sizeof...(Items) - 1) * NS + 1);
256 llvm::detail::join_items_impl(Result, Separator,
257 std::forward(Items)...);
256 detail::join_items_impl(Result, Separator, std::forward(Items)...);
258257 return Result;
259258 }
260259
7676 /// Returns -1 if unknown for the current host system.
7777 int getHostNumPhysicalCores();
7878
79 namespace detail {
80 /// Helper functions to extract HostCPUName from /proc/cpuinfo on linux.
81 StringRef getHostCPUNameForPowerPC(const StringRef &ProcCpuinfoContent);
82 StringRef getHostCPUNameForARM(const StringRef &ProcCpuinfoContent);
83 StringRef getHostCPUNameForS390x(const StringRef &ProcCpuinfoContent);
79 /// helper functions to extract HostCPUName from /proc/cpuinfo on linux.
80 namespace LinuxReadCpuInfo {
81 StringRef getHostCPUName_powerpc(const StringRef &ProcCpuinfoContent);
82 StringRef getHostCPUName_arm(const StringRef &ProcCpuinfoContent);
83 StringRef getHostCPUName_s390x(const StringRef &ProcCpuinfoContent);
8484 }
8585 }
8686 }
111111 static_assert(std::numeric_limits::is_integer &&
112112 !std::numeric_limits::is_signed,
113113 "Only unsigned integral types are allowed.");
114 return llvm::detail::TrailingZerosCounter::count(Val, ZB);
114 return detail::TrailingZerosCounter::count(Val, ZB);
115115 }
116116
117117 namespace detail {
180180 static_assert(std::numeric_limits::is_integer &&
181181 !std::numeric_limits::is_signed,
182182 "Only unsigned integral types are allowed.");
183 return llvm::detail::LeadingZerosCounter::count(Val, ZB);
183 return detail::LeadingZerosCounter::count(Val, ZB);
184184 }
185185
186186 /// \brief Get the index of the first set bit starting from the least
494494 static_assert(std::numeric_limits::is_integer &&
495495 !std::numeric_limits::is_signed,
496496 "Only unsigned integral types are allowed.");
497 return llvm::detail::PopulationCounter::count(Value);
497 return detail::PopulationCounter::count(Value);
498498 }
499499
500500 /// Log2 - This function returns the log base 2 of the specified value
1515
1616 using namespace sys;
1717
18 const char llvm::detail::unit>::value[] = "h";
19 const char llvm::detail::unit>::value[] = "m";
20 const char llvm::detail::unit>::value[] = "s";
21 const char llvm::detail::unit::value[] = "ms";
22 const char llvm::detail::unit::value[] = "us";
23 const char llvm::detail::unit::value[] = "ns";
18 const char detail::unit>::value[] = "h";
19 const char detail::unit>::value[] = "m";
20 const char detail::unit>::value[] = "s";
21 const char detail::unit::value[] = "ms";
22 const char detail::unit::value[] = "us";
23 const char detail::unit::value[] = "ns";
2424
2525 static inline struct tm getStructTM(TimePoint<> TP) {
2626 struct tm Storage;
6363 return std::move(*Text);
6464 }
6565
66 StringRef sys::detail::getHostCPUNameForPowerPC(
66 StringRef sys::LinuxReadCpuInfo::getHostCPUName_powerpc(
6767 const StringRef &ProcCpuinfoContent) {
6868 // Access to the Processor Version Register (PVR) on PowerPC is privileged,
6969 // and so we must use an operating-system interface to determine the current
143143 .Default(generic);
144144 }
145145
146 StringRef sys::detail::getHostCPUNameForARM(
146 StringRef sys::LinuxReadCpuInfo::getHostCPUName_arm(
147147 const StringRef &ProcCpuinfoContent) {
148148 // The cpuid register on arm is not accessible from user space. On Linux,
149149 // it is exposed through the /proc/cpuinfo file.
194194 return "generic";
195195 }
196196
197 StringRef sys::detail::getHostCPUNameForS390x(
197 StringRef sys::LinuxReadCpuInfo::getHostCPUName_s390x(
198198 const StringRef &ProcCpuinfoContent) {
199199 // STIDP is a privileged operation, so use /proc/cpuinfo instead.
200200
11961196 StringRef sys::getHostCPUName() {
11971197 std::unique_ptr P = getProcCpuinfoContent();
11981198 const StringRef& Content = P ? P->getBuffer() : "";
1199 return detail::getHostCPUNameForPowerPC(Content);
1199 return LinuxReadCpuInfo::getHostCPUName_powerpc(Content);
12001200 }
12011201 #elif defined(__linux__) && defined(__arm__)
12021202 StringRef sys::getHostCPUName() {
12031203 std::unique_ptr P = getProcCpuinfoContent();
12041204 const StringRef& Content = P ? P->getBuffer() : "";
1205 return detail::getHostCPUNameForARM(Content);
1205 return LinuxReadCpuInfo::getHostCPUName_arm(Content);
12061206 }
12071207 #elif defined(__linux__) && defined(__s390x__)
12081208 StringRef sys::getHostCPUName() {
12091209 std::unique_ptr P = getProcCpuinfoContent();
12101210 const StringRef& Content = P ? P->getBuffer() : "";
1211 return detail::getHostCPUNameForS390x(Content);
1211 return LinuxReadCpuInfo::getHostCPUName_s390x(Content);
12121212 }
12131213 #else
12141214 StringRef sys::getHostCPUName() { return "generic"; }
6565 Serial : 0000000000000000
6666 )";
6767
68 EXPECT_EQ(sys::detail::getHostCPUNameForARM(CortexA9ProcCpuinfo),
68 EXPECT_EQ(sys::LinuxReadCpuInfo::getHostCPUName_arm(CortexA9ProcCpuinfo),
6969 "cortex-a9");
70 EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x41\n"
71 "CPU part : 0xc0f"),
72 "cortex-a15");
70 EXPECT_EQ(
71 sys::LinuxReadCpuInfo::getHostCPUName_arm("CPU implementer : 0x41\n"
72 "CPU part : 0xc0f"),
73 "cortex-a15");
7374 // Verify that both CPU implementer and CPU part are checked:
74 EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x40\n"
75 "CPU part : 0xc0f"),
76 "generic");
77 EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x51\n"
78 "CPU part : 0x06f"),
79 "krait");
75 EXPECT_EQ(
76 sys::LinuxReadCpuInfo::getHostCPUName_arm("CPU implementer : 0x40\n"
77 "CPU part : 0xc0f"),
78 "generic");
79 EXPECT_EQ(
80 sys::LinuxReadCpuInfo::getHostCPUName_arm("CPU implementer : 0x51\n"
81 "CPU part : 0x06f"),
82 "krait");
8083 }