mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
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:
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user