IWYU: Add `--driver-mode=cl` when applicable
This is my first time contributing, so if there are some steps I missed, please let me know.
I ran into this issue (#16554 (closed)) and saw that there was no progress in !668 (closed) for some time.
I found !4208 (merged), which basically sets this up for clang tidy and followed the same approach. In contrast to clang-tidy
, there is no --extra-arg-before
, so I had to add a check if --driver-mode
is already part of the command string. I do not know, if std::string::find
is the correct method to call here. I took a quick look, but found no alternative in cmStringAlgorithms.h
.
Lastly, the code for getting the driverMode
is basically the same as for clang-tidy
. I chose not to refactor this into its own function and simply copied the code.
Fixes: #16554 (closed)