microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

Find All References cannot find typedef'ed structure for function argument correctly. #8180

Open shkit opened 3 years ago

shkit commented 3 years ago

Bug type: Language Service

Describe the bug Find All References cannot find typedef'ed structure for function argument correctly.

Steps to reproduce

  1. Open folder containg sample codes. (see screenshot)
  2. Right click and "Find All References" on func() in test.c
  3. See result. (REFERENCES and OTHER REFERENCES RESULTS)

Expected behavior

All reference can be see in REFERENCES, not in OTHER REFERENCES RESULTS.

Code sample and logs

------- Workspace parsing diagnostics ------- Number of files discovered (not excluded): 5672 Number of files parsed: 23

- Logs from [the language server logging](https://code.visualstudio.com/docs/cpp/enable-logging-cpp#_enable-logging-for-the-language-server)

tag parsing file: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\PROFESSIONAL\VC\TOOLS\MSVC\14.29.30133\INCLUDE\CODEANALYSIS\SOURCEANNOTATIONS.H sending compilation args for D:\HOME\KIT\WORKSPACE\CONSOLEAPPLICATION1\CONSOLEAPPLICATION1\MAIN.C include: D:\DATA\SOURCE\VCPKG\INSTALLED\X64-WINDOWS\INCLUDE include: D:\DATA\SOURCE\VCPKG\INSTALLED\X64-WINDOWS-STATIC\INCLUDE include: D:\DATA\SOURCE\VCPKG\INSTALLED\X86-WINDOWS\INCLUDE include: D:\DATA\SOURCE\VCPKG\INSTALLED\X86-WINDOWS-STATIC\INCLUDE include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\PROFESSIONAL\VC\TOOLS\MSVC\14.29.30133\INCLUDE include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\PROFESSIONAL\VC\TOOLS\MSVC\14.29.30133\ATLMFC\INCLUDE include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.20348.0\UM include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.20348.0\UCRT include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.20348.0\SHARED include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.20348.0\WINRT include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.20348.0\CPPWINRT define: _DEBUG define: UNICODE define: _UNICODE Shutting down IntelliSense server: D:\HOME\KIT\WORKSPACE\CONSOLEAPPLICATION1\CONSOLEAPPLICATION1\MAIN.C



**Screenshots**
<!-- If applicable, add screenshots to help explain your problem. -->
![screenshot](https://user-images.githubusercontent.com/114940/134436275-2bd16afc-fea8-4162-bcd9-7eeb28403fd1.png)

**Additional context**
<!--
Providing call stacks:
For bugs like crashes, deadlocks, infinite loops, etc. that we are not able to repro and for which the call stack may be useful, please attach a debugger and/or create a dmp and provide the call stacks. Windows binaries have symbols available in VS Code by setting your "symbolSearchPath" to "https://msdl.microsoft.com/download/symbols".

Instructions for attaching debugger to language service process:
https://github.com/microsoft/vscode-cpptools/wiki/Attaching-debugger-to-cpptools-or-cpptools%E2%80%90srv.

Performance analysis:
For a performance issue see instructions at https://github.com/microsoft/vscode-cpptools/wiki/Troubleshooting-Performance-Issues.
-->
Yes, this is not good code, I think.
But compilers do not warn and Visual Studio works correctly. I'm happy if VSCode also shows correct results.
sean-mcmanus commented 3 years ago

Thanks for reporting this. The APIs we're using aren't expanding the typedefs for function parameters which we use for type checking with types defined in other source files during find all references.

koffes commented 7 months ago

Any news on this issue?

sean-mcmanus commented 7 months ago

@koffes No news/progress on this issue (call hierarchy was implemented, but it also fails on this case). You can upvote this issue.