[all-commits] [llvm/llvm-project] 1b3a78: [clang] Use std::size instead of llvm::array_lengthof

Joseph Loser via All-commits all-commits at lists.llvm.org
Thu Sep 8 16:21:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1b3a78d1d534550b2f85a81b2e9ac6d7a94a478e
      https://github.com/llvm/llvm-project/commit/1b3a78d1d534550b2f85a81b2e9ac6d7a94a478e
  Author: Joe Loser <joeloser at fastmail.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

  Changed paths:
    M clang/include/clang/AST/OpenMPClause.h
    M clang/lib/AST/AttrDocTable.cpp
    M clang/lib/AST/CommentCommandTraits.cpp
    M clang/lib/Basic/DiagnosticIDs.cpp
    M clang/lib/Basic/Targets/NVPTX.h
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGObjC.cpp
    M clang/lib/Driver/ToolChains/Darwin.cpp
    M clang/lib/Driver/Types.cpp
    M clang/lib/Frontend/PrintPreprocessedOutput.cpp
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Sema/DeclSpec.cpp
    M clang/lib/Sema/ParsedAttr.cpp
    M clang/unittests/AST/CommentLexer.cpp
    M clang/unittests/AST/CommentParser.cpp
    M clang/unittests/AST/DeclPrinterTest.cpp
    M clang/unittests/Tooling/CompilationDatabaseTest.cpp

  Log Message:
  -----------
  [clang] Use std::size instead of llvm::array_lengthof

LLVM contains a helpful function for getting the size of a C-style
array: `llvm::array_lengthof`. This is useful prior to C++17, but not as
helpful for C++17 or later: `std::size` already has support for C-style
arrays.

Change call sites to use `std::size` instead. Leave the few call sites that
use a locally defined `array_lengthof` that are meant to test previous bugs
with NTTPs in clang analyzer and SemaTemplate.

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




More information about the All-commits mailing list