[PATCH] D137800: [llvm-driver] Reinvoke clang as described by llvm driver extra args

Alex Brachet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 22:11:46 PST 2023


abrachet added a comment.

In D137800#4038012 <https://reviews.llvm.org/D137800#4038012>, @phosek wrote:

> 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)?

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


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

https://reviews.llvm.org/D137800



More information about the llvm-commits mailing list