[llvm] c2487bf - Remove a workaround for MSVC 2013, now that MSVC 2017 is the minimum.

James Y Knight via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 10:57:45 PST 2021


Author: James Y Knight
Date: 2021-02-24T13:56:49-05:00
New Revision: c2487bf7dfdda59b775b3d5a06684af243790125

URL: https://github.com/llvm/llvm-project/commit/c2487bf7dfdda59b775b3d5a06684af243790125
DIFF: https://github.com/llvm/llvm-project/commit/c2487bf7dfdda59b775b3d5a06684af243790125.diff

LOG: Remove a workaround for MSVC 2013, now that MSVC 2017 is the minimum.

In MSVC 2013, 'alignas(integer-template-arg)' didn't compile; verified
on godbolt that this now works properly.

Added: 
    

Modified: 
    llvm/include/llvm/Support/TrailingObjects.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/TrailingObjects.h b/llvm/include/llvm/Support/TrailingObjects.h
index aaee0c4a3fc0..f9e711a5dc17 100644
--- a/llvm/include/llvm/Support/TrailingObjects.h
+++ b/llvm/include/llvm/Support/TrailingObjects.h
@@ -88,23 +88,6 @@ class TrailingObjectsBase {
   template <typename T> struct OverloadToken {};
 };
 
-template <int Align>
-class TrailingObjectsAligner : public TrailingObjectsBase {};
-template <>
-class alignas(1) TrailingObjectsAligner<1> : public TrailingObjectsBase {};
-template <>
-class alignas(2) TrailingObjectsAligner<2> : public TrailingObjectsBase {};
-template <>
-class alignas(4) TrailingObjectsAligner<4> : public TrailingObjectsBase {};
-template <>
-class alignas(8) TrailingObjectsAligner<8> : public TrailingObjectsBase {};
-template <>
-class alignas(16) TrailingObjectsAligner<16> : public TrailingObjectsBase {
-};
-template <>
-class alignas(32) TrailingObjectsAligner<32> : public TrailingObjectsBase {
-};
-
 // Just a little helper for transforming a type pack into the same
 // number of a 
diff erent type. e.g.:
 //   ExtractSecondType<Foo..., int>::type
@@ -204,8 +187,8 @@ class TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy, NextTy,
 // The base case of the TrailingObjectsImpl inheritance recursion,
 // when there's no more trailing types.
 template <int Align, typename BaseTy, typename TopTrailingObj, typename PrevTy>
-class TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy>
-    : public TrailingObjectsAligner<Align> {
+class alignas(Align) TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy>
+    : public TrailingObjectsBase {
 protected:
   // This is a dummy method, only here so the "using" doesn't fail --
   // it will never be called, because this function recurses backwards
@@ -290,8 +273,8 @@ class TrailingObjects : private trailing_objects_internal::TrailingObjectsImpl<
 #ifndef _MSC_VER
   using ParentType::OverloadToken;
 #else
-  // MSVC bug prevents the above from working, at least up through CL
-  // 19.10.24629.
+  // An MSVC bug prevents the above from working, (last tested at CL version
+  // 19.28). "Class5" in TrailingObjectsTest.cpp tests the problematic case.
   template <typename T>
   using OverloadToken = typename ParentType::template OverloadToken<T>;
 #endif


        


More information about the llvm-commits mailing list