Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I see the following pattern being duplicated:
if (ToolContext.IsDriver) Path = ToolContext.ReinvokeArgs[0]; ... if (ToolContext.ReinvokeArgs.size() > 1) TheDriver.setLLVMDriverPrependArg(ToolContext.ReinvokeArgs.back());
Could we split ReinvokeArgs into Path and PrependArgs (which would be nullptr if there are none)?
It'd be great if we could avoid IsDriver altogether to minimize the difference in behavior between the driver and non-driver case.
Sure.
It'd be great if we could avoid IsDriver altogether to minimize the difference in behavior between the driver and non-driver case.
Unfortunately, I had to still keep one IsDriver check in the GetExecutablePath so that it doesn't get the path of the executable in the driver case
clang/include/clang/Driver/Driver.h | ||
---|---|---|
295 | This wasn't addressed yet. | |
llvm/tools/llvm-driver/llvm-driver.cpp | ||
68 | Can we set PrependArg to nullptr in this case? It seems like we only ever use PrependArg if NeedsPrependArg is true in which case we may not even need NeedsPrependArg and could just check if PrependArg != null. |
LGTM
llvm/include/llvm/Support/LLVMDriver.h | ||
---|---|---|
18–24 | This is just a suggestion so feel free to ignore this, but I was thinking about these names a bit more and I think that Name and NeedsName might be more self-descriptive? |
I'd call it just PrependArg since it might have uses outside of LLVM driver.