llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.15k stars 12.03k forks source link

clang-tidy doesn't process @responseFile after -- (but it works with --extra-arg in @responseFile) #55311

Open sean-mcmanus opened 2 years ago

sean-mcmanus commented 2 years ago

With clang 14.0.3 on Windows using

test.cpp

#include <sub>
#include <sub2>

test.rsp

-I<path>/sub -I<path>/sub2

This works: "C:\Program Files\LLVM\bin\clang.exe" "<path>/test.cpp" @<path>/test.rsp

This does not: "C:\Program Files\LLVM\bin\clang-tidy.exe" "<path>/test.cpp" -- @<path>/test.rsp

But using a modified test2.rsp with --extra-arg added to each individual entry works:

--extra-arg=-I<path>/sub --extra-arg=-I<path>/sub2

"C:\Program Files\LLVM\bin\clang-tidy.exe" "<path>/test.cpp" @<path>/test2.rsp --

Bug: It seems like @responseFiles should work after -- and not just before the -- when --extra-arg are added, since replacing the @responseFile with the -I contents works (after the --). If there's a reason it can't, it would be nice if additional documentation could be added at https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/ (or equivalent for clang 15) explaining the difference between --extra-arg and -- for this case or others if they exist.

Response files are required on Windows when the command line length limit is exceeded (i.e. due to too many -I, which commonly repros with Unreal Engine projects, although in most scenarios -p would be used instead of --).

llvmbot commented 2 years ago

@llvm/issue-subscribers-clang-tidy