[PATCH] D133520: [clang] Use std::size instead of llvm::array_lengthof

Joe Loser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 8 13:32:52 PDT 2022


jloser created this revision.
jloser added reviewers: MaskRay, kazu, dblaikie, aaron.ballman.
Herald added subscribers: mattd, gchakrabarti, asavonic, StephenFan.
Herald added a project: All.
jloser requested review of this revision.
Herald added subscribers: cfe-commits, jholewinski.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133520

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133520.458844.patch
Type: text/x-patch
Size: 24825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220908/9d896840/attachment-0001.bin>


More information about the cfe-commits mailing list