[compiler-rt] [scudo] Group type traits into a single header (NFC) (PR #118888)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 11:33:47 PST 2024


================
@@ -0,0 +1,49 @@
+//===-- type_traits.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SCUDO_TYPE_TRAITS_H_
+#define SCUDO_TYPE_TRAITS_H_
+
+namespace scudo {
+
+template <typename T> struct removeConst {
+  using type = T;
+};
+template <typename T> struct removeConst<const T> {
+  using type = T;
+};
+
+// This is only used for SFINAE when detecting if a type is defined.
+template <typename T> struct voidAdaptor {
+  using type = void;
+};
+
+// This is used for detecting the case that defines the flag with wrong type and
----------------
ChiaHungDuan wrote:

Given that this is moved to an independent file and I think the class name is self-explained so I just remove the comment and updated the description of static_assert to "Type mismatches" (it was "Flag type mismatches").

https://github.com/llvm/llvm-project/pull/118888


More information about the llvm-commits mailing list