[PATCH] D118281: Rename llvm::array_lengthof into llvm::size

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 13:02:48 PST 2022


serge-sans-paille created this revision.
serge-sans-paille added reviewers: jcranmer, thakis.
Herald added subscribers: sdasgup3, luke957, asavonic, wenzhicui, wrengr, Chia-hungDuan, foad, dcaballe, cota, teijeong, frasercrmck, dexonsmith, rdzhabarov, tatianashp, ThomasRaoux, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, kerbowa, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, csigg, antiagainst, shauheen, mravishankar, rriddle, mehdi_amini, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, rupprecht, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, atanasyan, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, fedor.sergeev, kbarton, hiraditya, nhaehnle, jvesely, nemanjai, sdardis, dylanmckay, jyknight, arsenm, jholewinski.
Herald added a reviewer: jhenderson.
Herald added a reviewer: antiagainst.
Herald added a reviewer: aartbik.
Herald added a reviewer: MaskRay.
serge-sans-paille requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, stephenneuendorffer, nicolasvasilache.
Herald added projects: MLIR, LLVM.

llvm::array_lengthof matches the behavior of std::size from C++17, so I renamed it
and moved it to llvm/ADT/STLForwardCompat.h

For consistency, I also added llvm::size over any container with a size method,
which is also available in C++17.

There is, however, already an llvm::size available in llvm/ADT/STLExtras.h,
that's an extension of std::size over ranges with O(1) iterator difference. I've
kept this implementation in STLExtras.h because it's... an extra extension to
the standard.


https://reviews.llvm.org/D118281

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/lib/AST/ASTContext.cpp
  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/Compilation.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/lib/Driver/Types.cpp
  clang/lib/Frontend/PrintPreprocessedOutput.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/DeclSpec.cpp
  clang/lib/Sema/ParsedAttr.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/lib/Sema/TreeTransform.h
  clang/unittests/AST/CommentLexer.cpp
  clang/unittests/AST/CommentParser.cpp
  clang/unittests/AST/DeclPrinterTest.cpp
  clang/unittests/Tooling/CompilationDatabaseTest.cpp
  lld/COFF/Chunks.cpp
  lldb/source/DataFormatters/FormatManager.cpp
  lldb/source/Host/common/MainLoop.cpp
  lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
  lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
  lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
  lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
  lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
  lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
  lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
  lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
  lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
  lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
  lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
  lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp
  lldb/source/Plugins/Process/Utility/RegisterContextWindows_i386.cpp
  lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp
  lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp
  lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp
  lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
  lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp
  lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
  lldb/source/Plugins/Process/Windows/Common/arm/RegisterContextWindows_arm.cpp
  lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
  lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
  lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp
  lldb/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp
  lldb/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/unittests/Utility/StatusTest.cpp
  llvm/include/llvm/ADT/STLExtras.h
  llvm/include/llvm/ADT/STLForwardCompat.h
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/include/llvm/MC/SubtargetFeature.h
  llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  llvm/lib/CodeGen/TargetLoweringBase.cpp
  llvm/lib/DWP/DWP.cpp
  llvm/lib/IR/DebugInfoMetadata.cpp
  llvm/lib/MC/MCAsmBackend.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/Object/MachOObjectFile.cpp
  llvm/lib/Support/ARMAttributeParser.cpp
  llvm/lib/Support/CrashRecoveryContext.cpp
  llvm/lib/Support/NativeFormatting.cpp
  llvm/lib/Support/RISCVAttributeParser.cpp
  llvm/lib/Support/Triple.cpp
  llvm/lib/Support/Unix/Signals.inc
  llvm/lib/Support/Windows/Path.inc
  llvm/lib/Support/Windows/Signals.inc
  llvm/lib/Support/X86TargetParser.cpp
  llvm/lib/Support/raw_ostream.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
  llvm/lib/Target/AMDGPU/AMDGPULibFunc.cpp
  llvm/lib/Target/AMDGPU/R600RegisterInfo.cpp
  llvm/lib/Target/ARC/ARCISelLowering.cpp
  llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
  llvm/lib/Target/ARM/ARMFrameLowering.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/Thumb2SizeReduction.cpp
  llvm/lib/Target/AVR/AVRISelLowering.cpp
  llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
  llvm/lib/Target/Hexagon/HexagonFrameLowering.h
  llvm/lib/Target/Hexagon/HexagonHardwareLoops.cpp
  llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
  llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
  llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp
  llvm/lib/Target/MSP430/MCTargetDesc/MSP430AsmBackend.cpp
  llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
  llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
  llvm/lib/Target/Mips/Mips16ISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCCallingConv.cpp
  llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/Sparc/Disassembler/SparcDisassembler.cpp
  llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
  llvm/lib/Target/VE/VEFrameLowering.h
  llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/XCore/XCoreISelLowering.cpp
  llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
  llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
  llvm/lib/Transforms/Utils/MetaRenamer.cpp
  llvm/tools/llvm-config/llvm-config.cpp
  llvm/tools/llvm-objdump/COFFDump.cpp
  llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp
  llvm/tools/llvm-readobj/ELFDumper.cpp
  llvm/unittests/ADT/APFloatTest.cpp
  llvm/unittests/ADT/StringRefTest.cpp
  llvm/unittests/ADT/TinyPtrVectorTest.cpp
  llvm/unittests/ProfileData/CoverageMappingTest.cpp
  llvm/unittests/Support/BinaryStreamTest.cpp
  llvm/unittests/Support/CommandLineTest.cpp
  llvm/unittests/Support/FormatVariadicTest.cpp
  llvm/unittests/Support/TargetParserTest.cpp
  llvm/utils/KillTheDoctor/KillTheDoctor.cpp
  llvm/utils/TableGen/AsmWriterEmitter.cpp
  llvm/utils/TableGen/CodeGenTarget.cpp
  llvm/utils/TableGen/RegisterInfoEmitter.cpp
  llvm/utils/TableGen/X86DisassemblerTables.cpp
  mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
  mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
  mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118281.403385.patch
Type: text/x-patch
Size: 152496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220126/314b82f4/attachment-0001.bin>


More information about the llvm-commits mailing list