This is an archive of the discontinued LLVM Phabricator instance.

[LLVM][Support] Support for `llvm::cl::list`'s default values
ClosedPublic

Authored by tyb0807 on Oct 5 2022, 1:08 PM.

Details

Summary

This patch introduces support for default values of list of CL options.
It fixes the issue in https://github.com/llvm/llvm-project/issues/52667

Diff Detail

Event Timeline

tyb0807 created this revision.Oct 5 2022, 1:08 PM
Herald added a project: Restricted Project. · View Herald Transcript
tyb0807 requested review of this revision.Oct 5 2022, 1:08 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 5 2022, 1:08 PM
zero9178 added inline comments.Oct 5 2022, 2:08 PM
llvm/include/llvm/Support/CommandLine.h
440

The naming here is a bit unfortunate since it sort of clashes with the common C++ vocabulary that is std::initializer_list but I don't have a lot of better ideas :(

441

All these const llvm::ArrayRef<Ty>& ought to be able to just be llvm::ArrayRef<Ty> (both in the struct here and the function parameters below). ArrayRef essentially already acts as a view/reference to some storage and is cheap and trivially copyable. I believe you can also drop the llvm:: namespace qualifier

tyb0807 updated this revision to Diff 465714.Oct 6 2022, 6:31 AM
tyb0807 marked 2 inline comments as done.

Change initialization functions' names and correctly use ArrayRef

llvm/include/llvm/Support/CommandLine.h
440

Maybe I'll go with list_initializer and list_init to avoid name collision

bkramer accepted this revision.Oct 6 2022, 9:28 AM

looks good now

This revision is now accepted and ready to land.Oct 6 2022, 9:28 AM
This revision was landed with ongoing or failed builds.Oct 6 2022, 10:51 AM
This revision was automatically updated to reflect the committed changes.