Skip to content
  • Bernd Buschinski's avatar
    FunctionDefinition: only look for (new/other) function definition if we don't have one · 3c51faa2
    Bernd Buschinski authored
    Summary:
    FunctionDefinition::definition always looks for FunctionDefinition based on the DeclarationId, but we don't need to do that if we already have a FunctionDefinition.
    This could cause problems if we have multiple (same) definitions.
    
    Test Plan:
    - create a small cmake (or whatever) project with 3 targets
    -- util1.c / util2.c / util3.c (same content):
    
    ```
    #include <stdio.h>
    #include <stdlib.h>
    
    void configure()
    {
        printf("do stuff in %s\n", __FILE__);
    }
    
    int main(int argc, char *argv[])
    {
        configure();
        puts("Hello, UTIL!");
        exit(EXIT_SUCCESS);
    }
    ```
    
    -- CMakeLists.txt:
    ```
    add_executable(util1 util1.c)
    add_executable(util2 util2.c)
    add_executable(util3 util3.c)
    ```
    
    - open util1.c
    - open the outline and select "configure"
    - EXPECTED: it should open the configure in util1.c (or the currently opened file)
    - repeat with util2 and util3
    - ACTUAL: only one of them works, the other two point to the wrong file.
    
    Reviewers: #kdevelop, mwolff
    
    Reviewed By: #kdevelop, mwolff
    
    Subscribers: mwolff, kdevelop-devel
    
    Tags: #kdevelop
    
    Differential Revision: https://phabricator.kde.org/D16356
    3c51faa2