]> granicus.if.org Git - llvm/commitdiff
Revert "Make naming in Host.h in line with coding standards."
authorKristof Beyls <kristof.beyls@arm.com>
Thu, 30 Mar 2017 11:06:25 +0000 (11:06 +0000)
committerKristof Beyls <kristof.beyls@arm.com>
Thu, 30 Mar 2017 11:06:25 +0000 (11:06 +0000)
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

include/llvm/ADT/DenseSet.h
include/llvm/ADT/StringExtras.h
include/llvm/Support/Host.h
include/llvm/Support/MathExtras.h
lib/Support/Chrono.cpp
lib/Support/Host.cpp
unittests/Support/Host.cpp

index 8d7d613023307dabbc048d8f029ad278981f0872..fcf304c3ecc41060846c2f327515a04536a25917 100644 (file)
@@ -179,12 +179,12 @@ public:
   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);
   }
 
@@ -193,12 +193,11 @@ public:
   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.
@@ -213,15 +212,15 @@ public:
 
 /// 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;
@@ -232,14 +231,13 @@ public:
 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:
index ae65f29cfe11175e3339750f4aab5d76abef2328..8214782bfe800e3a3c00605d5dfeecd0a0aeb6a5 100644 (file)
@@ -231,7 +231,7 @@ inline size_t join_items_size(const A1 &A, Args &&... Items) {
 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
@@ -251,11 +251,10 @@ inline std::string join_items(Sep Separator, Args &&... Items) {
   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;
 }
 
index 89986fdae9713d23546e50c9d29e87ebebb14f7f..22a61f760648f1fcb55320f20abf0f84e3dc9534 100644 (file)
@@ -77,11 +77,11 @@ constexpr bool IsBigEndianHost = false;
   /// 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);
   }
 }
 }
index 846ab6646606a233d39f4f35bb50d3ae1e5a062c..77970f487112a031eb6759e2ad02be95bcbe7a09 100644 (file)
@@ -112,7 +112,7 @@ std::size_t countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width) {
   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 {
@@ -181,7 +181,7 @@ std::size_t countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) {
   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
@@ -495,7 +495,7 @@ inline unsigned countPopulation(T Value) {
   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
index daccaf1fc103d58e4590afb32dcade88663649a7..ca748f5c046c0cdf9a1b478fd3d804bb1dc0b75e 100644 (file)
@@ -16,12 +16,12 @@ namespace llvm {
 
 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;
index 54fbb558c432d1f5f675ade231f69b7b7d2e15a6..230d0921184a208fb358d1f9567e346dabe49e1d 100644 (file)
@@ -64,7 +64,7 @@ static std::unique_ptr<llvm::MemoryBuffer>
   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
@@ -144,7 +144,7 @@ StringRef sys::detail::getHostCPUNameForPowerPC(
       .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.
@@ -195,7 +195,7 @@ StringRef sys::detail::getHostCPUNameForARM(
   return "generic";
 }
 
-StringRef sys::detail::getHostCPUNameForS390x(
+StringRef sys::LinuxReadCpuInfo::getHostCPUName_s390x(
     const StringRef &ProcCpuinfoContent) {
   // STIDP is a privileged operation, so use /proc/cpuinfo instead.
 
@@ -1197,19 +1197,19 @@ StringRef sys::getHostCPUName() {
 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"; }
index 48f021e54275cd85a0a4582efeb47ba05038c560..0d22ba8ca79585d2710ab8e9740e34111645c8d9 100644 (file)
@@ -66,16 +66,19 @@ Revision        : 0000
 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");
 }