microsoft / vscode-cpptools

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

Function definition resolution does not work for a "define argument list" #11974

Open Alex66955 opened 8 months ago

Alex66955 commented 8 months ago

Environment

Bug Summary and Steps to Reproduce

"Go to Definition" does not work for functions with an argument list, which is defined by a "define". image

module1.cpp

#include "module1.hpp"

int works1(mydefine1) {
    return 1;
}

int works2(int a) {
    return 1;
}

int works3(int a, int b) {
    return 1;
}

int doesNotWorkwork1(mydefine2) {
    return 1;
}

module2.cpp

#include "module1.hpp"

void myTestFunction() {
    works1(1);
    works2(1);
    works3(1, 2);

    doesNotWorkwork1(1, 2);
}

module1.hpp

#define mydefine1 int a
#define mydefine2 int a,int b

int works1(mydefine1);
int works2(int a);
int works3(int a, int b);

int doesNotWorkwork1(mydefine2);

Expected behavior:

Resolution is working as same as works1, works2 and works3

Configuration and Logs

-------- Diagnostics - 2/15/2024, 1:40:12 PM
Version: 1.18.5
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/opt/wsp/vscode-remote-try-cpp/**"
    ],
    "defines": [],
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "intelliSenseModeIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPath": "",
    "browse": {
        "path": [
            "/opt/wsp/vscode-remote-try-cpp/**",
            "${workspaceFolder}"
        ]
    }
}
cpptools version (native): 1.18.3.0
Translation Unit Mappings:
[ /opt/wsp/vscode-remote-try-cpp/module2.cpp ]:
    /opt/wsp/vscode-remote-try-cpp/module2.cpp
Translation Unit Configurations:
[ /opt/wsp/vscode-remote-try-cpp/module2.cpp ]:
    Process ID: 308228
    Memory Usage: 13 MB
    Standard Version: c++17
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=130100
Total Memory Usage: 13 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 13
Number of files parsed: 3

Other Extensions

No response

Additional context

No response

parlov commented 3 months ago

I also needed this for my project!