Skip to content
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

go to declaration #9678

Open
Bestie123 opened this issue Aug 3, 2022 · 14 comments
Open

go to declaration #9678

Bestie123 opened this issue Aug 3, 2022 · 14 comments
Labels
bug Feature: Go to Definition An issue related to Go to Definition/Declaration. Language Service Verified - Internal Verified issue reproduces Works in VS So we'd need to fix it for VS Code to reach parity.

Comments

@Bestie123
Copy link

Bestie123 commented Aug 3, 2022

Environment

  • OS and Version: windows 10
  • VS Code Version: 1.69.2
  • C/C++ Extension Version: 1.11.4
  • Other extensions you installed (and if the issue persists after disabling them):
  • If using SSH remote, specify OS of remote machine:
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).

the display of all parameter declarations disappears

directory used as a project:
https://github.com/llvm/llvm-project

Bug Summary and Steps to Reproduce

directory used as a project:
https://github.com/llvm/llvm-project

the path to the file to open:
G:\llvm-project-main\llvm-project-main\clang\include\clang\Basic\CodeGenOptions.h

at the beginning of the project opening, if you hover the cursor over "setDebugInfo", all definitions of this parameter are shown
image

if you right-click on "CODEGENOPT" and select "go to declaration", then all the places where this parameter is declared will be displayed in the list
image

next comes some kind of file processing and when you hover the cursor over "CODEGENOPT", the display of the remaining parameter declarations disappears
image

also, the "go to declaration" function stops working for the "CODEGENOPT" parameter.
for the "ENUM_CODEGENOPT" parameter, the "go to declaration" function works, but other declarations of this parameter in this file stop being displayed.
image

the display of all ads disappears after the output of this debugging information to the console
image

Expected behavior

  1. it is expected that all parameter declarations will be displayed when the mouse cursor hovers over it

  2. it is expected that when you right-click on the parameter and select the "go to declaration" option, all the places where this parameter is defined will be displayed

  3. the expected behavior when hovering the cursor can be viewed in the wboq documentation generator

https://blog.weghos.com/llvm/llvm/clang/include/clang/Frontend/CodeGenOptions.h.html#34

image

Code sample and Logs

c_cpp_properties.json


{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.19041.0",
            "compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe",
            "cStandard": "c17",
            "cppStandard": "c++14",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}

Screenshots

No response

Additional context

No response

@michelleangela michelleangela self-assigned this Aug 4, 2022
@Bestie123
Copy link
Author

Bestie123 commented Aug 5, 2022

an example of displaying navigation in visual studio. as you can see, all parameter definitions are displayed here. But navigation in visual studio is inconvenient due to the fact that the syntax is not displayed.def and in def there is no code navigation in the drop-down list, so it is preferable to use vs code + c/c++ extension
image

image

you may also notice that visual studio and vs code give references to the clang/Frontend/Code Gen.def and flang/Frontend/CodeGenOptions.def parameters instead of displaying only clang, as the woboq documentation generator does, this is probably due to various code analysis technologies, I read somewhere that woboq uses analysis, in which the source code is analyzed sequentially, as when compiling and building a project
image

@michelleangela michelleangela added Language Service Feature: Go to Definition An issue related to Go to Definition/Declaration. bug labels Aug 5, 2022
@Colengms
Copy link
Contributor

Hi @Bestie123 . Does this issue still occur for you with 1.11.5 or 1.12.1 ? We recently addressed a crash issue specifically with llvm-project, that could have led to this behavior.

@Bestie123
Copy link
Author

Bestie123 commented Aug 19, 2022

Hi @Colengms . version 1.12.1. now the navigation is displayed correctly. it is not yet possible to generate code and compare it more thoroughly with the navigation display in woboq, but in general it seems that everything works correctly
image

image

@sean-mcmanus
Copy link
Contributor

So we can close this issue?

@Bestie123
Copy link
Author

@sean-mcmanus . yes, you can close

@michelleangela michelleangela removed their assignment Aug 19, 2022
@Bestie123
Copy link
Author

@sean-mcmanus I made a mistake, the problem still occurs, I didn't have time to report it, I can record a video with a demonstration of the problem, also, if necessary, I can provide an archive with the analyzed llvmproject code and an archive with the generated woboq documentation for the first archive. Should I open a new question or can I write here?

@sean-mcmanus sean-mcmanus reopened this Sep 7, 2022
@sean-mcmanus
Copy link
Contributor

You can add more info to this issue.

@Bestie123
Copy link
Author

Bestie123 commented Sep 9, 2022

@sean-mcmanus

  • my archive with llvm-project-14.0.6 without /build/bin /build/ /build/lib /build/tools folders, because these folders are about 100 gigabytes after the project compilation.

The file is zipped using the 7-zip archiver without a password, then encrypted using the encrypto program. Encryption password: 12345
https://vk.com/s/v1/doc/KnPBtXnXDhjByaKG-4Ss_xjJ2kqalJbqptA1KHtDesq8AvAGGss

You can also download the source code on github: https://github.com/llvm/llvm-project/releases/tag/llvmorg-14.0.6

  • an archive of generated woboq documentation (optional) (useful for an example of how definitions should be).
    Warning!! The woboq documentation has 700,000+ generated files and weighs 6 gigabytes when unpacked. Due to the fact that the files are small - copying and deleting files can be very slow
    Private definitions not showing up in woboq: Declarations KDAB/codebrowser#98
    image

To use the documentation, you must place the unpacked folders on a web server (for example, on a local one).
example of opening the root directory documentation: http://localhost/llvm3/index.html
archive password: 12345
archive: https://vk.com/s/v1/doc/GZC_zXGMoT8q7AIR7BB3OCamyQMkdJ8W_9xx1_kllxlfCuO59Pw

AT 1:20 Compared to the screenshot from Visual Studio, the definition of CodegenOptions.def is missing
https://user-images.githubusercontent.com/15684883/183204158-0d60229c-6ff8-4948-a3b0-96bb1ac2118f.png

At 1:49 Exception initialization or access occurs and then at 1:53 there is a new list of definitions that contains one definition, and the old ones disappear somewhere

At 1:59 when calling the "go to declaration" call in development at 2:08 now it appears that no matches were found, but if you accidentally open the CodegenOptions.def file, then at 3:14 the call to "go to declaration" will display at 3 :28 list of all matches, but there will be no matches that were at 1:20

compileCommands and databaseFilename in c_cpp_properties.json can be omitted.
If you use compileCommands, then you need to change the paths to the source files inside compile_commands.json to your location

Code example
c_cpp_properties.json

{
"config": [
{
"name": "Win32",
"include path": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.20348.0",
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang++.exe",
"cStandard": "c89",
"cppStandard": "C++14",
"intelliSenseMode": "windows-clang-x64",
"view": {
"databaseFilename": "G:/browse.vc.db"
},
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"Merge Configurations": true
}
],
"version": 4
}

@sean-mcmanus sean-mcmanus added the To Verify - Internal To verify if issue reproduces label Sep 12, 2022
@v-ericawu v-ericawu added Verified - Internal Verified issue reproduces and removed To Verify - Internal To verify if issue reproduces labels Sep 14, 2022
@Bestie123
Copy link
Author

Bestie123 commented Sep 17, 2022

@sean-mcmanus

I also noticed another problem. It is probably a separate error

  1. Run vscode
  2. Now open the file "llvm-project-llvmorg-14.0.6\clang\include\clang\Basic\CodeGenOptions.def".
  3. After analysis, screenshot 1 shows that when hovering over the "CODEGENOPT" parameter, an error appears
  4. If you try to open some .cpp file, then after parsing open CodeGenOptions.def, then the errors will stop appearing. This can be seen in screenshot 2.
  5. Screenshot 3 shows that before opening the .cpp file, if you right click "CODEGENOPT" and select "Find All References" from the drop down list, then 1) Screenshot 3 shows that 173 links were found, and below are some vague links.

Screenshot 4 shows that after opening the .cpp file, if you right-click "CODEGENOPT" and select "Find all References" from the drop-down list, then
2) Now 180 found links are displayed

Visual Studio has a similar issue. The .def file is parsed normally, but then something happens and nothing helps to eliminate parsing errors. Repairing Visual Studio doesn't help, and neither does restarting the computer.
In visual studio, this problem affects the search for links, links are no longer found due to errors in the analysis of .def files.
Screenshot 5 shows an example of a similar problem in visual studio. Screenshot 6 shows that the file was previously analyzed without errors, but then something happened, and analysis errors already appear in screenshot 5. This problem is relevant for visual studio 2019 and 2022, it has not been tested in older versions.
P.S. screenshot 6 was taken a few days earlier than the rest.

image

image

image

image

image

vVNP_NQCbsTmmMSMBf-Cc4rlfuXFcW_OlXvCvUWQTBSgZ0rniA-CYEA2a5n8S9tyjVGDhTPePNsG9mcfYgziFv_B

@sean-mcmanus sean-mcmanus added the investigate: repro This issue's repro steps needs to be investigated/confirmed label Sep 19, 2022
@sean-mcmanus sean-mcmanus added this to the 1.13 milestone Sep 19, 2022
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Sep 19, 2022

FYI, if you're able to repro the bug in VS 2022, then it's preferably that you file a bug directly on the VS developer community site, since it's mostly caused by shared code...otherwise, we have to do that ourselves, and it might take us longer to get around to doing that.

@Bestie123
Copy link
Author

Bestie123 commented Sep 22, 2022

@sean-mcmanus sean-mcmanus modified the milestones: 1.13, Tracking Oct 3, 2022
@sean-mcmanus sean-mcmanus added Visual Studio Inherited from Visual Studio and removed investigate: repro This issue's repro steps needs to be investigated/confirmed labels Oct 3, 2022
@sean-mcmanus
Copy link
Contributor

@Bestie123 Okay, thanks, I've changed this issue to Tracking the VS issue.

@sean-mcmanus sean-mcmanus modified the milestones: Tracking, 1.15.0 Mar 15, 2023
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Mar 15, 2023
@sean-mcmanus sean-mcmanus removed this from the 1.15.0 milestone Mar 15, 2023
@sean-mcmanus sean-mcmanus added Works in VS So we'd need to fix it for VS Code to reach parity. and removed fixed Check the Milestone for the release in which the fix is or will be available. Visual Studio Inherited from Visual Studio labels Mar 15, 2023
@sean-mcmanus
Copy link
Contributor

It looks like they fixed it with VS 17.6, but we don't have the fix, although we may in the future.

@Bestie123
Copy link
Author

@sean-mcmanus,
I have checked visual studio. Indeed, the problems have been fixed, so far there have been no serious problems. The exception is when you restart visual studio and select "show all links". The display may break and give out the wrong links or more than they actually are. This is sort of solved by choosing "show definition" then "show all links". Later I will inform the developers about this shortcoming.
In vs code, the link search still breaks down and part of it just disappears. vs code uses exactly the new compiler since I reinstalled windows the other day and put all programs on clean.
Also, the values in the .def file are now highlighted in turquoise, perhaps this indicates that a new compiler is being used. Previously, these words were not searched for in visual studio, now they are referenced in visual studio, but not in VS code. Finds something in the code, but it seems to also truncate the results
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Feature: Go to Definition An issue related to Go to Definition/Declaration. Language Service Verified - Internal Verified issue reproduces Works in VS So we'd need to fix it for VS Code to reach parity.
Projects
None yet
Development

No branches or pull requests

5 participants