We have a few functions that virtually all command wants to run on
process startup/shutdown. This patch adds InitLLVM class to do them
all at once, so that we don't copy-n-paste boilerplate code to main()
function of each llvm utility command.
Details
Diff Detail
- Build Status
Buildable 17043 Build 17043: arc lint + arc unit
Event Timeline
There are several other tools that have similar initialization (but don't use GetArgumentVector). They should be updated also - and that will also fix their issue with UTF-8 on Windows.
llvm/tools/llvm-rc/llvm-rc.cpp | ||
---|---|---|
81 | By doing this in this file, ExitOnErr (which is used later in the main function) no longer has the banner set. I suspect the same may be true in some of the other files too. Perhaps InitLLVM could return an ExitOnError object which is already initialized with the correct banner? |
- set banners to ExitOnError objects
llvm/tools/llvm-rc/llvm-rc.cpp | ||
---|---|---|
81 | Looks like ExitOnError can take a banner as its constructor argument. |
llvm/tools/llvm-ar/llvm-ar.cpp | ||
---|---|---|
957 ↗ | (On Diff #142318) | Why not use ToolName? Or remove ToolName? |
llvm/tools/llvm-rc/llvm-rc.cpp | ||
81 | I noticed that several of the files that you changed set the banner of ExitOnError after InitLLVM to argv[0] (which is also what InitLLVM does), while a couple set just the name of the tool. Could you change the ones that set just the name of the tool to also use argv[0] for consistency? |
The last comment would be nice to have, but not necessary. LGTM.
llvm/tools/llvm-rc/llvm-rc.cpp | ||
---|---|---|
81 | Then in llvm-pdbutil.cpp and here, you should undo the change to the declaration of ExitOnError and bring back the setBanner statements in the main() functions. |
By doing this in this file, ExitOnErr (which is used later in the main function) no longer has the banner set. I suspect the same may be true in some of the other files too.
Perhaps InitLLVM could return an ExitOnError object which is already initialized with the correct banner?