C++: Extend jump-to-def support to template instantiations.

This commit extends developers ability to use jump-to-def in C/C++ files opened in the VSCode extension.
Before, jump-to-def starting with code in a template instantiation did not work.

Furthermore, this fixes a bug, as the list of all references of a location did not include template instantiations.
This commit is contained in:
Cornelius Riemenschneider
2020-10-21 21:35:38 +02:00
parent a92a701c35
commit 9388448053
5 changed files with 20 additions and 18 deletions

View File

@@ -4,7 +4,7 @@ import definitions
* An element that is the source of a jump-to-definition link.
*/
class Link extends Top {
Link() { exists(definitionOf(this, _)) }
Link() { exists(definitionOf(this, _, false)) }
}
/**
@@ -31,7 +31,7 @@ predicate linkLocationInfo(Link e, string filepath, int begin, int end) {
* Gets a string describing a problem with a `Link`.
*/
string issues(Link e) {
strictcount(Top def | def = definitionOf(e, _)) > 1 and
strictcount(Top def | def = definitionOf(e, _, false)) > 1 and
result = "has more than one definition"
or
exists(string filepath1, int begin1, int end1, Link e2, string filepath2, int begin2, int end2 |