[all-commits] [llvm/llvm-project] bc60cf: [clang] adds unary type transformations as compile...

Christopher Di Bella via All-commits all-commits at lists.llvm.org
Sun Aug 14 10:34:00 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bc60cf2368de90918719dc7e3d7c63a72cc007ad
      https://github.com/llvm/llvm-project/commit/bc60cf2368de90918719dc7e3d7c63a72cc007ad
  Author: Christopher Di Bella <cjdb at google.com>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M clang/include/clang/AST/Type.h
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Basic/Specifiers.h
    M clang/include/clang/Basic/TokenKinds.def
    A clang/include/clang/Basic/TransformTypeTraits.def
    M clang/include/clang/Parse/Parser.h
    M clang/include/clang/Sema/DeclSpec.h
    M clang/include/clang/Sema/Sema.h
    M clang/include/clang/module.modulemap
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/JSONNodeDumper.cpp
    M clang/lib/AST/TextNodeDumper.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/Format/FormatToken.cpp
    M clang/lib/Format/FormatToken.h
    M clang/lib/Format/TokenAnnotator.cpp
    M clang/lib/Lex/PPMacroExpansion.cpp
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Parse/ParseDeclCXX.cpp
    M clang/lib/Parse/ParseExpr.cpp
    M clang/lib/Parse/ParseExprCXX.cpp
    M clang/lib/Parse/ParseStmt.cpp
    M clang/lib/Parse/ParseTentative.cpp
    M clang/lib/Sema/DeclSpec.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaTemplateVariadic.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/test/CodeGenCXX/mangle.cpp
    A clang/test/SemaCXX/libstdcxx_transform_type_traits_hack.cpp
    A clang/test/SemaCXX/remove_pointer.mm
    M clang/test/SemaCXX/type-traits.cpp
    M clang/utils/ClangVisualizers/clang.natvis

  Log Message:
  -----------
  [clang] adds unary type transformations as compiler built-ins

Adds

* `__add_lvalue_reference`
* `__add_pointer`
* `__add_rvalue_reference`
* `__decay`
* `__make_signed`
* `__make_unsigned`
* `__remove_all_extents`
* `__remove_extent`
* `__remove_const`
* `__remove_volatile`
* `__remove_cv`
* `__remove_pointer`
* `__remove_reference`
* `__remove_cvref`

These are all compiler built-in equivalents of the unary type traits
found in [[meta.trans]][1]. The compiler already has all of the
information it needs to answer these transformations, so we can skip
needing to make partial specialisations in standard library
implementations (we already do this for a lot of the query traits). This
will hopefully improve compile times, as we won't need use as much
memory in such a base part of the standard library.

[1]: http://wg21.link/meta.trans

Co-authored-by: zoecarver

Reviewed By: aaron.ballman, rsmith

Differential Revision: https://reviews.llvm.org/D116203


  Commit: 06a1d917ef1f507aaa2f6891bb654696c866ea3a
      https://github.com/llvm/llvm-project/commit/06a1d917ef1f507aaa2f6891bb654696c866ea3a
  Author: Christopher Di Bella <cjdb at google.com>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M libcxx/include/__type_traits/add_lvalue_reference.h
    M libcxx/include/__type_traits/add_pointer.h
    M libcxx/include/__type_traits/add_rvalue_reference.h
    M libcxx/include/__type_traits/decay.h
    M libcxx/include/__type_traits/is_referenceable.h
    M libcxx/include/__type_traits/is_swappable.h
    M libcxx/include/__type_traits/make_signed.h
    M libcxx/include/__type_traits/make_unsigned.h
    M libcxx/include/__type_traits/remove_all_extents.h
    M libcxx/include/__type_traits/remove_const.h
    M libcxx/include/__type_traits/remove_cv.h
    M libcxx/include/__type_traits/remove_cvref.h
    M libcxx/include/__type_traits/remove_extent.h
    M libcxx/include/__type_traits/remove_pointer.h
    M libcxx/include/__type_traits/remove_reference.h
    M libcxx/include/__type_traits/remove_volatile.h
    M libcxx/test/libcxx/utilities/meta/is_referenceable.pass.cpp

  Log Message:
  -----------
  [libcxx][NFC] utilises compiler builtins for unary transform type-traits

Depends on D116203

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D131732


Compare: https://github.com/llvm/llvm-project/compare/4f04be564907...06a1d917ef1f


More information about the All-commits mailing list