-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@response file
failed to used in clang-tidy.exe with a large project(such as ue4.28)
#8843
Comments
Our code analysis implementation doesn't directly process the compile commands file or the response files contained in it -- we rely on the IntelliSense configuration. You should not be trying to pass in any additional "-p or --" as args. Is IntelliSense able to find the headers when opening XXXEffect.cpp? If so, then code analysis should also be able to without any additional configuration. |
FYI, the compile commands generated by Unreal Engine may be incorrect, leading to incorrect IntelliSense and therefore incorrect code analysis configuration (another user hit this in issue #8812 ). |
Our extension will create a response file when there are too many include paths, which may occur with the Unreal Engine. Are you saying our extension has a bug in that case or is the compile commands itself incorrect? |
For the log, extension will create a response file with
Then, I try to use |
@SambeauWang Are you able to determine why the XXXComponent.h header can't be found, i.e. what folder is it located in and why that folder is not being added as a -I and/or why it's able to be found with -p? Is IntelliSense working with XXXEffect.cpp? |
@sean-mcmanus I try to use the path of XXXComponent.h in cmd, such as Then I try to move
I think it maybe result in the error which the args is too long in |
Hi @SambeauWang . Could this be a duplicate of #8812 ? I appear to be some issues with Unreal Editor currently generating incorrect compile_commands files. |
Can you run C/C++: Log Diagnostics after opening XXXEffect.cpp and see whether or not the path to XXXComponent.h is in the Includes list? That should be identical to what we are using in the -I in the response file we generate for clang-tidy. |
Hi @SambeauWang.
We should be passing all of the same arguments as were present in For the source file involved, could you provide the complete build command line? (The As I mentioned in my previous comment, there are known issues with UE 4.27 that result in headers not being found. I'm not sure if that has been addressed in 4.28. Where can I find 4.28? :) |
@Colengms Thank you for help. (1) From the log, I think this extension use |
The Log Diagnostics file is actually logging from the C/C++ pane -- can you run the C/C++: Log Diagnostics command and get logging from the C++ Diagnostics pane? |
The log from the C++ Diagnostics is follewed. |
It says "No active translation units." -- we need the C/C++: Log Diagnostics command to be run after the repro file (XXXEffect.cpp) is opened and IntelliSense has finished initializing (flame icon goes away). |
"No active translation units." is still. flame icon goes away, and error is show in |
What is the error in the problems window? Does it say it can't find the header XXXComponent.h? Can you make sure C_Cpp.intelliSenseEngineFallback is set to "Disabled"? |
Those are clang diagnostic errors -- are you getting any IntelliSense errors (they appear as |
C_Cpp.intelliSenseEngine is set to "Tag parse". "C/C++" logging(LogDiagnostics.txt) is showed above. |
After C_Cpp.intelliSenseEngine is set to "Default", the log of |
So does IntelliSense give any error squiggles, particularly about missing headers? I compared the include paths and it appears that the IntelliSense has about 44 fewer include paths compared to the response file, but it seems like they may have been generated using different source files. If you're still getting missing headers reported during code analysis, can you provide the path to that header so I can see if it's in the IntelliSense includes (or you could check)? Our code analysis feature wasn't designed/implemented to work without the IntelliSense engine...we could potentially add a feature request to support that and/or add a better warning message and/or disable it instead of having it run incorrectly. The 2 GB memory usage of the IntelliSense engine suggests that it may be out of scope for our current implementation to handle well -- you may want to try switching to VS 2022 which has some additional optimizations that make Unreal Engine work better with less memory (which we don't have yet, see #3628): see https://devblogs.microsoft.com/cppblog/18x-faster-intellisense-for-unreal-engine-projects-in-visual-studio-2022/ . |
@sean-mcmanus Thank you for help. Now I use VS2022 to work with Unreal Engine. But VSCode and cpptool extension is more lightweight and friendly. So I try to set C_Cpp.intelliSenseEngine is set to "Tag parse", and want to use clang-tidy.exe to do a simple grammar check. It maybe result in |
FYI, VS also has some clang-tidy support, but it's somewhat different: https://docs.microsoft.com/en-us/cpp/code-quality/clang-tidy?view=msvc-170 . I've filed a feature request on enabling clang-tidy without IntelliSense at #8874 . The |
This issue has been closed automatically because it needs more information and has not had recent activity. |
FYI, we found a bug with our response file handling (#9102) -- it should be fixed with our next 1.10.1 insiders. Multiple threads would try to use the same response file, so a workaround would be to set |
Yeah, I'm seeing @response files not working with clang-tidy -- seems like our tests were inheriting the include paths from the environment instead of getting them from the response file :( |
This should be fixed with 1.10.2 (pre-release). |
Bug type: Language Service
Describe the bug
Steps to reproduce
Expected behavior
(1) a new choice for use
-p <build-path>
instead of--
for compile info inclang-tidy
(https://clang.llvm.org/extra/clang-tidy/).(2) use Clang-tidy feature in unreal engine vscode-cpptool
Code sample and logs
c_cpp_properties.json
C/C++: Log Diagnostics
from the VS Code command paletteAdditional context
I try to use clang-tidy.exe in cmd, and try to use
@response file
. It failed to use@response file
in clang-tidy.(1) I try to use
"C:\Users\XXX\.vscode\extensions\ms-vscode.cpptools-1.8.5\LLVM\bin\clang-tidy.exe" --quiet XXX.cpp -- @G:\master\compile_flags.txt
. The result iserror: 'XXXComponent.h' file not found
@response file
is follewed.(2) I try to move
--
to@response file
and merge all args as one line(the command is"C:\Users\XXX\.vscode\extensions\ms-vscode.cpptools-1.8.5\LLVM\bin\clang-tidy.exe" --quiet XXX.cpp @G:\master\compile_flags.txt
).error: 'XXXComponent.h' file not found
is not exit.@response file
is follewed.(3) I try to use
-p XXX.txt
instead of--
. Such as"C:\Users\XXX\.vscode\extensions\ms-vscode.cpptools-1.8.5\LLVM\bin\clang-tidy.exe" --quiet XXX.cpp -p G:\master\compile_flags.txt
. It work fine with ue4.28 project.compile_flags.txt
is follewed.Then I try to use
-p XXX.txt
tocpptools
extension as args, it fail working.--
and-p XXX.txt
may be conflict(https://clang.llvm.org/extra/clang-tidy/).The text was updated successfully, but these errors were encountered: