[PATCH] D117598: [llvm-profdata] Use SubCommands to simplify code

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 19 11:55:21 PST 2022


wenlei added inline comments.


================
Comment at: llvm/lib/ProfileData/InstrProf.cpp:59-66
+namespace llvm {
+namespace llvm_profdata {
+// We define these llvm-profdata subcommands here so that we can add them to the
+// top-level options that they depend on, which are outside of llvm-profdata.cpp
+cl::SubCommand MergeSubCommand("merge", "LLVM profile data merger tool");
+cl::SubCommand ShowSubCommand("show", "LLVM profile data summary tool");
+} // namespace llvm_profdata
----------------
The commands used by tools shouldn't live in ProfileData library. 


================
Comment at: llvm/lib/ProfileData/SampleProf.cpp:36
     "profile-symbol-list-cutoff", cl::Hidden, cl::init(-1), cl::ZeroOrMore,
+    cl::sub(*cl::TopLevelSubCommand), cl::sub(llvm_profdata::MergeSubCommand),
+    cl::sub(llvm_profdata::ShowSubCommand),
----------------
This creates a dependency from profile data to llvm-profdata, and ideally should be avoided. 

Same for other changes in ProfileData


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117598/new/

https://reviews.llvm.org/D117598



More information about the llvm-commits mailing list