FunctionDefinition: only look for (new/other) function definition if we don't have one
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