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.
llvm-svn: 299066
void erase(ConstIterator CI) { return TheMap.erase(CI.I); }
std::pair<iterator, bool> insert(const ValueT &V) {
- llvm::detail::DenseSetEmpty Empty;
+ detail::DenseSetEmpty Empty;
return TheMap.try_emplace(V, Empty);
}
std::pair<iterator, bool> insert(ValueT &&V) {
- llvm::detail::DenseSetEmpty Empty;
+ detail::DenseSetEmpty Empty;
return TheMap.try_emplace(std::move(V), Empty);
}
template <typename LookupKeyT>
std::pair<iterator, bool> insert_as(const ValueT &V,
const LookupKeyT &LookupKey) {
- return TheMap.insert_as({V, llvm::detail::DenseSetEmpty()}, LookupKey);
+ return TheMap.insert_as({V, detail::DenseSetEmpty()}, LookupKey);
}
template <typename LookupKeyT>
std::pair<iterator, bool> insert_as(ValueT &&V, const LookupKeyT &LookupKey) {
- return TheMap.insert_as({std::move(V), llvm::detail::DenseSetEmpty()},
- LookupKey);
+ return TheMap.insert_as({std::move(V), detail::DenseSetEmpty()}, LookupKey);
}
// Range insertion of values.
/// Implements a dense probed hash-table based set.
template <typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT>>
-class DenseSet
- : public llvm::detail::DenseSetImpl<
- ValueT, DenseMap<ValueT, llvm::detail::DenseSetEmpty, ValueInfoT,
- llvm::detail::DenseSetPair<ValueT>>,
- ValueInfoT> {
- using BaseT = llvm::detail::DenseSetImpl<
- ValueT, DenseMap<ValueT, llvm::detail::DenseSetEmpty, ValueInfoT,
- llvm::detail::DenseSetPair<ValueT>>,
- ValueInfoT>;
+class DenseSet : public detail::DenseSetImpl<
+ ValueT, DenseMap<ValueT, detail::DenseSetEmpty, ValueInfoT,
+ detail::DenseSetPair<ValueT>>,
+ ValueInfoT> {
+ using BaseT =
+ detail::DenseSetImpl<ValueT,
+ DenseMap<ValueT, detail::DenseSetEmpty, ValueInfoT,
+ detail::DenseSetPair<ValueT>>,
+ ValueInfoT>;
public:
using BaseT::BaseT;
template <typename ValueT, unsigned InlineBuckets = 4,
typename ValueInfoT = DenseMapInfo<ValueT>>
class SmallDenseSet
- : public llvm::detail::DenseSetImpl<
- ValueT,
- SmallDenseMap<ValueT, llvm::detail::DenseSetEmpty, InlineBuckets,
- ValueInfoT, llvm::detail::DenseSetPair<ValueT>>,
+ : public detail::DenseSetImpl<
+ ValueT, SmallDenseMap<ValueT, detail::DenseSetEmpty, InlineBuckets,
+ ValueInfoT, detail::DenseSetPair<ValueT>>,
ValueInfoT> {
- using BaseT = llvm::detail::DenseSetImpl<
- ValueT, SmallDenseMap<ValueT, llvm::detail::DenseSetEmpty, InlineBuckets,
- ValueInfoT, llvm::detail::DenseSetPair<ValueT>>,
+ using BaseT = detail::DenseSetImpl<
+ ValueT, SmallDenseMap<ValueT, detail::DenseSetEmpty, InlineBuckets,
+ ValueInfoT, detail::DenseSetPair<ValueT>>,
ValueInfoT>;
public:
template <typename IteratorT>
inline std::string join(IteratorT Begin, IteratorT End, StringRef Separator) {
typedef typename std::iterator_traits<IteratorT>::iterator_category tag;
- return llvm::detail::join_impl(Begin, End, Separator, tag());
+ return detail::join_impl(Begin, End, Separator, tag());
}
/// Joins the strings in the range [R.begin(), R.end()), adding Separator
if (sizeof...(Items) == 0)
return Result;
- size_t NS = llvm::detail::join_one_item_size(Separator);
- size_t NI = llvm::detail::join_items_size(std::forward<Args>(Items)...);
+ size_t NS = detail::join_one_item_size(Separator);
+ size_t NI = detail::join_items_size(std::forward<Args>(Items)...);
Result.reserve(NI + (sizeof...(Items) - 1) * NS + 1);
- llvm::detail::join_items_impl(Result, Separator,
- std::forward<Args>(Items)...);
+ detail::join_items_impl(Result, Separator, std::forward<Args>(Items)...);
return Result;
}
/// Returns -1 if unknown for the current host system.
int getHostNumPhysicalCores();
- 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);
+ /// helper functions to extract HostCPUName from /proc/cpuinfo on linux.
+ namespace LinuxReadCpuInfo {
+ StringRef getHostCPUName_powerpc(const StringRef &ProcCpuinfoContent);
+ StringRef getHostCPUName_arm(const StringRef &ProcCpuinfoContent);
+ StringRef getHostCPUName_s390x(const StringRef &ProcCpuinfoContent);
}
}
}
static_assert(std::numeric_limits<T>::is_integer &&
!std::numeric_limits<T>::is_signed,
"Only unsigned integral types are allowed.");
- return llvm::detail::TrailingZerosCounter<T, sizeof(T)>::count(Val, ZB);
+ return detail::TrailingZerosCounter<T, sizeof(T)>::count(Val, ZB);
}
namespace detail {
static_assert(std::numeric_limits<T>::is_integer &&
!std::numeric_limits<T>::is_signed,
"Only unsigned integral types are allowed.");
- return llvm::detail::LeadingZerosCounter<T, sizeof(T)>::count(Val, ZB);
+ return detail::LeadingZerosCounter<T, sizeof(T)>::count(Val, ZB);
}
/// \brief Get the index of the first set bit starting from the least
static_assert(std::numeric_limits<T>::is_integer &&
!std::numeric_limits<T>::is_signed,
"Only unsigned integral types are allowed.");
- return llvm::detail::PopulationCounter<T, sizeof(T)>::count(Value);
+ return detail::PopulationCounter<T, sizeof(T)>::count(Value);
}
/// Log2 - This function returns the log base 2 of the specified value
using namespace sys;
-const char llvm::detail::unit<std::ratio<3600>>::value[] = "h";
-const char llvm::detail::unit<std::ratio<60>>::value[] = "m";
-const char llvm::detail::unit<std::ratio<1>>::value[] = "s";
-const char llvm::detail::unit<std::milli>::value[] = "ms";
-const char llvm::detail::unit<std::micro>::value[] = "us";
-const char llvm::detail::unit<std::nano>::value[] = "ns";
+const char detail::unit<std::ratio<3600>>::value[] = "h";
+const char detail::unit<std::ratio<60>>::value[] = "m";
+const char detail::unit<std::ratio<1>>::value[] = "s";
+const char detail::unit<std::milli>::value[] = "ms";
+const char detail::unit<std::micro>::value[] = "us";
+const char detail::unit<std::nano>::value[] = "ns";
static inline struct tm getStructTM(TimePoint<> TP) {
struct tm Storage;
return std::move(*Text);
}
-StringRef sys::detail::getHostCPUNameForPowerPC(
+StringRef sys::LinuxReadCpuInfo::getHostCPUName_powerpc(
const 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
.Default(generic);
}
-StringRef sys::detail::getHostCPUNameForARM(
+StringRef sys::LinuxReadCpuInfo::getHostCPUName_arm(
const StringRef &ProcCpuinfoContent) {
// The cpuid register on arm is not accessible from user space. On Linux,
// it is exposed through the /proc/cpuinfo file.
return "generic";
}
-StringRef sys::detail::getHostCPUNameForS390x(
+StringRef sys::LinuxReadCpuInfo::getHostCPUName_s390x(
const StringRef &ProcCpuinfoContent) {
// STIDP is a privileged operation, so use /proc/cpuinfo instead.
StringRef sys::getHostCPUName() {
std::unique_ptr<llvm::MemoryBuffer> P = getProcCpuinfoContent();
const StringRef& Content = P ? P->getBuffer() : "";
- return detail::getHostCPUNameForPowerPC(Content);
+ return LinuxReadCpuInfo::getHostCPUName_powerpc(Content);
}
#elif defined(__linux__) && defined(__arm__)
StringRef sys::getHostCPUName() {
std::unique_ptr<llvm::MemoryBuffer> P = getProcCpuinfoContent();
const StringRef& Content = P ? P->getBuffer() : "";
- return detail::getHostCPUNameForARM(Content);
+ return LinuxReadCpuInfo::getHostCPUName_arm(Content);
}
#elif defined(__linux__) && defined(__s390x__)
StringRef sys::getHostCPUName() {
std::unique_ptr<llvm::MemoryBuffer> P = getProcCpuinfoContent();
const StringRef& Content = P ? P->getBuffer() : "";
- return detail::getHostCPUNameForS390x(Content);
+ return LinuxReadCpuInfo::getHostCPUName_s390x(Content);
}
#else
StringRef sys::getHostCPUName() { return "generic"; }
Serial : 0000000000000000
)";
- EXPECT_EQ(sys::detail::getHostCPUNameForARM(CortexA9ProcCpuinfo),
+ EXPECT_EQ(sys::LinuxReadCpuInfo::getHostCPUName_arm(CortexA9ProcCpuinfo),
"cortex-a9");
- EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x41\n"
- "CPU part : 0xc0f"),
- "cortex-a15");
+ EXPECT_EQ(
+ sys::LinuxReadCpuInfo::getHostCPUName_arm("CPU implementer : 0x41\n"
+ "CPU part : 0xc0f"),
+ "cortex-a15");
// Verify that both CPU implementer and CPU part are checked:
- EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x40\n"
- "CPU part : 0xc0f"),
- "generic");
- EXPECT_EQ(sys::detail::getHostCPUNameForARM("CPU implementer : 0x51\n"
- "CPU part : 0x06f"),
- "krait");
+ EXPECT_EQ(
+ sys::LinuxReadCpuInfo::getHostCPUName_arm("CPU implementer : 0x40\n"
+ "CPU part : 0xc0f"),
+ "generic");
+ EXPECT_EQ(
+ sys::LinuxReadCpuInfo::getHostCPUName_arm("CPU implementer : 0x51\n"
+ "CPU part : 0x06f"),
+ "krait");
}