[Lldb-commits] [PATCH] D140896: [WIP] Move from llvm::makeArrayRef to ArrayRef deduction guides

serge via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 3 07:17:57 PST 2023


serge-sans-paille created this revision.
Herald added subscribers: libc-commits, hanchung, kadircet, Moerafaat, kmitropoulou, zero9178, Enna1, bzcheeseman, kosarev, mattd, gchakrabarti, ThomasRaoux, pmatos, asb, ayermolo, awarzynski, arjunp, sdasgup3, asavonic, carlosgalvezp, Groverkss, wenzhicui, wrengr, armkevincheng, ormris, foad, jsetoain, jsmolens, sjarus, eric-k256, cota, mravishankar, teijeong, frasercrmck, rdzhabarov, ecnelises, tatianashp, wenlei, mehdi_amini, jdoerfert, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, kerbowa, liufengdb, aartbik, mgester, arpith-jacob, csigg, antiagainst, shauheen, rriddle, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, arphaman, the_o, brucehoult, MartinMosbeck, rogfer01, steven_wu, atanasyan, edward-jones, zzheng, jrtc27, martong, niosHD, sabuasal, simoncook, johnrusso, rbar, fedor.sergeev, kbarton, hiraditya, jgravelle-google, arichardson, sbc100, jvesely, nemanjai, sdardis, emaste, dylanmckay, jyknight, dschuff, arsenm, qcolombet, MatzeB.
Herald added a reviewer: JDevlieghere.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: shafik.
Herald added a reviewer: jhenderson.
Herald added a reviewer: antiagainst.
Herald added a reviewer: rriddle.
Herald added a reviewer: antiagainst.
Herald added a reviewer: aartbik.
Herald added a reviewer: MaskRay.
Herald added a reviewer: jpienaar.
Herald added a reviewer: ftynse.
Herald added a reviewer: awarzynski.
Herald added a reviewer: bondhugula.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a reviewer: ThomasRaoux.
Herald added a reviewer: NoQ.
Herald added a reviewer: njames93.
Herald added projects: libc-project, Flang, All.
serge-sans-paille requested review of this revision.
Herald added subscribers: cfe-commits, llvm-commits, lldb-commits, pcwang-thead, yota9, StephenFan, stephenneuendorffer, nicolasvasilache, aheejin, jholewinski.
Herald added a reviewer: nicolasvasilache.
Herald added a reviewer: herhut.
Herald added a reviewer: dcaballe.
Herald added projects: clang, LLDB, MLIR, LLVM, clang-tools-extra.

Since we're now requiring C++17, Let's get rid of `makeXXX` functions like `makeArrayRef`, and use deduction guides instead.

Apart from codebase modernization, there isn't much benefit from that
move, but I can still mention that it would slightly (probably
negligibly) decrease the number of symbols / debug info, as deduction
guides don't generate new code.

The only non-automatic changes have been:

1. Write the deduction guides
2. `ArrayRef(some_uint8_pointer, 0)` needs to be changed into `ArrayRef(some_uint8_pointer, (size_t)0)` to avoid an ambiguous call with `ArrayRef((uint8_t*), (uint8_t*))`
3. `CVSymbol sym(makeArrayRef(symStorage));` needed to be rewritten as `CVSymbol sym{ArrayRef(symStorage)};` otherwise the compiler is confused and thinks we have a (bad) function prototype. There was a few similar situation across the codebase.
4. ADL doesn't seem to work the same for deductio-guides and functions, so at some point the `llvm` namespace must be explicitly stated.
5. The "reference mode" of `makeArrayRef(ArrayRef<T> &)` that acts as no-op is not supported (a constructor cannot achieve that).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140896

Files:
  bolt/tools/bat-dump/bat-dump.cpp
  bolt/tools/driver/llvm-bolt.cpp
  bolt/tools/heatmap/heatmap.cpp
  clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
  clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp
  clang-tools-extra/clang-tidy/concurrency/MtUnsafeCheck.cpp
  clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
  clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/CompileCommands.cpp
  clang-tools-extra/clangd/FindSymbols.cpp
  clang-tools-extra/clangd/Preamble.cpp
  clang-tools-extra/clangd/Selection.cpp
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
  clang-tools-extra/clangd/tool/Check.cpp
  clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
  clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
  clang-tools-extra/pseudo/include/clang-pseudo/Forest.h
  clang-tools-extra/pseudo/include/clang-pseudo/GLR.h
  clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
  clang-tools-extra/pseudo/lib/Forest.cpp
  clang-tools-extra/pseudo/lib/GLR.cpp
  clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
  clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
  clang/include/clang/AST/Decl.h
  clang/include/clang/AST/DeclCXX.h
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclOpenMP.h
  clang/include/clang/AST/DeclTemplate.h
  clang/include/clang/AST/Expr.h
  clang/include/clang/AST/ExprCXX.h
  clang/include/clang/AST/ExprObjC.h
  clang/include/clang/AST/ExprOpenMP.h
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/PropertiesBase.td
  clang/include/clang/AST/Stmt.h
  clang/include/clang/AST/StmtOpenMP.h
  clang/include/clang/AST/TemplateBase.h
  clang/include/clang/AST/TemplateName.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeLoc.h
  clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
  clang/include/clang/Basic/Diagnostic.h
  clang/include/clang/Basic/SyncScope.h
  clang/include/clang/CodeGen/CGFunctionInfo.h
  clang/include/clang/Lex/MacroInfo.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/DeclSpec.h
  clang/include/clang/Sema/DelayedDiagnostic.h
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/ASTRecordReader.h
  clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
  clang/include/clang/Tooling/Transformer/RewriteRule.h
  clang/lib/AST/APValue.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTDiagnostic.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/CommentParser.cpp
  clang/lib/AST/CommentSema.cpp
  clang/lib/AST/ComputeDependence.cpp
  clang/lib/AST/Decl.cpp
  clang/lib/AST/DeclCXX.cpp
  clang/lib/AST/DeclTemplate.cpp
  clang/lib/AST/ExprCXX.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/ParentMapContext.cpp
  clang/lib/AST/TemplateName.cpp
  clang/lib/AST/Type.cpp
  clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
  clang/lib/Analysis/CFG.cpp
  clang/lib/Analysis/CalledOnceCheck.cpp
  clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
  clang/lib/Basic/Module.cpp
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/Basic/Targets/ARC.h
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/Basic/Targets/AVR.h
  clang/lib/Basic/Targets/BPF.cpp
  clang/lib/Basic/Targets/CSKY.cpp
  clang/lib/Basic/Targets/Hexagon.cpp
  clang/lib/Basic/Targets/Lanai.cpp
  clang/lib/Basic/Targets/LoongArch.cpp
  clang/lib/Basic/Targets/M68k.cpp
  clang/lib/Basic/Targets/MSP430.cpp
  clang/lib/Basic/Targets/MSP430.h
  clang/lib/Basic/Targets/Mips.cpp
  clang/lib/Basic/Targets/Mips.h
  clang/lib/Basic/Targets/NVPTX.cpp
  clang/lib/Basic/Targets/PPC.cpp
  clang/lib/Basic/Targets/RISCV.cpp
  clang/lib/Basic/Targets/Sparc.cpp
  clang/lib/Basic/Targets/SystemZ.cpp
  clang/lib/Basic/Targets/VE.cpp
  clang/lib/Basic/Targets/VE.h
  clang/lib/Basic/Targets/WebAssembly.cpp
  clang/lib/Basic/Targets/X86.cpp
  clang/lib/Basic/Targets/XCore.cpp
  clang/lib/Basic/Targets/XCore.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExprConstant.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenPGO.cpp
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/CodeGen/ConstantInitBuilder.cpp
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/CodeGen/MicrosoftCXXABI.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/Job.cpp
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/lib/Format/MacroCallReconstructor.cpp
  clang/lib/Frontend/ASTUnit.cpp
  clang/lib/Interpreter/Interpreter.cpp
  clang/lib/Lex/TokenLexer.cpp
  clang/lib/Parse/ParsePragma.cpp
  clang/lib/Sema/ParsedAttr.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaRISCVVectorLookup.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
  clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
  clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/ComputeReplacements.cpp
  clang/lib/Tooling/Syntax/Tokens.cpp
  clang/lib/Tooling/Tooling.cpp
  clang/tools/diagtool/DiagnosticNames.cpp
  clang/tools/diagtool/FindDiagnosticID.cpp
  clang/tools/driver/driver.cpp
  clang/tools/libclang/CIndex.cpp
  clang/tools/libclang/CIndexCodeCompletion.cpp
  clang/tools/libclang/Indexing.cpp
  clang/unittests/Driver/ToolChainTest.cpp
  clang/unittests/Introspection/IntrospectionTest.cpp
  clang/unittests/Lex/LexerTest.cpp
  clang/unittests/Lex/PPDependencyDirectivesTest.cpp
  clang/unittests/Tooling/Syntax/TokensTest.cpp
  clang/unittests/Tooling/Syntax/TreeTestBase.cpp
  clang/unittests/Tooling/ToolingTest.cpp
  flang/lib/Lower/ConvertVariable.cpp
  flang/tools/flang-driver/driver.cpp
  libc/benchmarks/LibcDefaultImplementations.cpp
  libc/benchmarks/LibcMemoryBenchmarkMain.cpp
  libc/benchmarks/automemcpy/lib/CodeGen.cpp
  libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
  lld/COFF/Chunks.h
  lld/COFF/DebugTypes.cpp
  lld/COFF/DriverUtils.cpp
  lld/COFF/PDB.cpp
  lld/ELF/Arch/AMDGPU.cpp
  lld/ELF/Arch/AVR.cpp
  lld/ELF/Arch/PPC64.cpp
  lld/ELF/Arch/RISCV.cpp
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/InputFiles.h
  lld/ELF/InputSection.cpp
  lld/ELF/InputSection.h
  lld/ELF/OutputSections.cpp
  lld/ELF/SyntheticSections.cpp
  lld/ELF/Writer.cpp
  lldb/include/lldb/Utility/AnsiTerminal.h
  lldb/include/lldb/Utility/Args.h
  lldb/source/API/SBDebugger.cpp
  lldb/source/Breakpoint/BreakpointID.cpp
  lldb/source/Commands/CommandObjectBreakpoint.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Commands/CommandObjectDiagnostics.cpp
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectFrame.cpp
  lldb/source/Commands/CommandObjectHelp.cpp
  lldb/source/Commands/CommandObjectLog.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Commands/CommandObjectMemoryTag.cpp
  lldb/source/Commands/CommandObjectPlatform.cpp
  lldb/source/Commands/CommandObjectProcess.cpp
  lldb/source/Commands/CommandObjectRegister.cpp
  lldb/source/Commands/CommandObjectScript.cpp
  lldb/source/Commands/CommandObjectSession.cpp
  lldb/source/Commands/CommandObjectSettings.cpp
  lldb/source/Commands/CommandObjectSource.cpp
  lldb/source/Commands/CommandObjectStats.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/CommandObjectTrace.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Commands/CommandObjectWatchpoint.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Commands/CommandOptionsProcessLaunch.cpp
  lldb/source/Host/common/NativeProcessProtocol.cpp
  lldb/source/Interpreter/OptionGroupArchitecture.cpp
  lldb/source/Interpreter/OptionGroupFormat.cpp
  lldb/source/Interpreter/OptionGroupMemoryTag.cpp
  lldb/source/Interpreter/OptionGroupOutputFile.cpp
  lldb/source/Interpreter/OptionGroupUUID.cpp
  lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
  lldb/source/Interpreter/OptionGroupVariable.cpp
  lldb/source/Interpreter/OptionGroupWatchpoint.cpp
  lldb/source/Interpreter/OptionValueBoolean.cpp
  lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
  lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
  lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
  lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
  lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
  lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
  lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
  lldb/source/Symbol/UnwindPlan.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/StackFrameRecognizer.cpp
  lldb/source/Utility/Args.cpp
  (340 more files...)



More information about the lldb-commits mailing list