-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C++: Instantiate model generation library #19295
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
Merged
MathiasVP
merged 14 commits into
github:main
from
MathiasVP:cpp-add-mad-generation-library
Apr 23, 2025
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3d48b23
C++: Instantiate model generation library.
MathiasVP f241e4b
C++: Add tests that will soon succeed.
MathiasVP 09ebd6e
C++: Instantiate inline expectation test framework to test model gene…
MathiasVP 1465058
C++: Add copy-pasted files from C#.
MathiasVP 1f43e51
C++: Fix ql-for-ql findings.
MathiasVP 5462dcd
C++: Make final member functions not extensible.
MathiasVP 0ce6ab5
Remove an unnecessary if.
MathiasVP 9cba91c
C++: Add another entry to 'qlpack' for external models.
MathiasVP e55f94c
C++: Move contents of 'isUninterestingForDataFlowModels' to 'relevant'
MathiasVP f6f5f97
C++: Also make protected members irrelevant.
MathiasVP 6fcf56e
C++: Add more tests.
MathiasVP 3fd760c
C++: Move 'InlineMadTest.qll' out of 'lib/utils/test' and into 'test'…
MathiasVP 07d8f8d
C++: Add an empty model to prevent a warning.
MathiasVP 9e9a580
C++: Add MaD generation test with union content.
MathiasVP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
C++: Instantiate inline expectation test framework to test model gene…
…ration.
- Loading branch information
commit 09ebd6e87dcf8f9f66f96b8854247f814d1d1be0
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
private import cpp | ||
private import codeql.mad.test.InlineMadTest | ||
|
||
class MadRelevantFunction extends Function { | ||
MadRelevantFunction() { not this.isFromUninstantiatedTemplate(_) } | ||
} | ||
|
||
private module InlineMadTestLang implements InlineMadTestLangSig { | ||
class Callable = MadRelevantFunction; | ||
|
||
/** | ||
* Holds if `c` is the closest `Callable` that suceeds `comment` in the file. | ||
*/ | ||
private predicate hasClosestCallable(CppStyleComment comment, Callable c) { | ||
c = | ||
min(Callable cand, int dist | | ||
// This has no good join order, but should hopefully be good enough for tests. | ||
cand.getFile() = comment.getFile() and | ||
dist = cand.getLocation().getStartLine() - comment.getLocation().getStartLine() and | ||
dist > 0 | ||
| | ||
cand order by dist | ||
) | ||
} | ||
|
||
string getComment(Callable c) { | ||
exists(CppStyleComment comment | | ||
hasClosestCallable(comment, c) and | ||
result = comment.getContents().suffix(2) | ||
) | ||
} | ||
} | ||
|
||
import InlineMadTestImpl<InlineMadTestLang> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.