Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] Templatized code not found #18122

Open
JustusAdam opened this issue Nov 27, 2024 · 0 comments
Open

[C++] Templatized code not found #18122

JustusAdam opened this issue Nov 27, 2024 · 0 comments
Labels
question Further information is requested

Comments

@JustusAdam
Copy link

This issue is more me double checking that I did not make a mistake here. It appears that code in uninstantiated templates is inaccessible for analysis.

I’m trying to use CodeQL on a templatized library but it appears that the code within a function template cannot be analyzed? I understand that if I instantiate the template somewhere I will be able to analyze it but I just wanted to make sure I did not miss a way to analyze the templated code without instantiation.

void target()
{
}

template <typename T>
void entry()
{
    target();
}

void entry2()
{
    target();
}

This is the query I run

import cpp

from Call c
where c.getTarget().getName() = "target"
select c, c.getLocation().getStartLine()

This is the output.

|       c        | col1 |
+----------------+------+
| call to target |   13 |

If the templated code were found I would expect to also see a call in line 8.

CodeQL version: 2.19.3

@JustusAdam JustusAdam added the question Further information is requested label Nov 27, 2024
@JustusAdam JustusAdam changed the title Templatized code not found [C++] Templatized code not found Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant