mirror of
https://github.com/github/codeql.git
synced 2026-08-02 00:13:00 +02:00
Remove "commit N does X" and "currently wrong / pre-fix" narrative from test.cpp and locations.ql; where appropriate, replace with concise process-free descriptions of the code (e.g. "Raw string literal; content offset 3"). Line count and column positions of every regex literal are preserved (empty lines take the place of removed comment lines), so no .expected file changes. Remaining "Note:" comments in the .qll files describe code semantics (excluded forms / handling), not the build process, and are kept. Bundle: github/codeql-action codeql-bundle-v2.26.1 (CodeQL CLI 2.26.1).
27 lines
878 B
Plaintext
27 lines
878 B
Plaintext
/**
|
|
* Reports per-term location info for each regex term, showing the literal's
|
|
* start column, the term's value offsets, and the computed start/end columns.
|
|
* Used to verify that `hasLocationInfo` produces correct columns for plain,
|
|
* raw, and encoding-prefixed C++ string literals.
|
|
*/
|
|
|
|
import cpp
|
|
import semmle.code.cpp.regex.RegexTreeView as RE
|
|
|
|
query predicate locations(
|
|
RE::RegExpTerm t,
|
|
int litStartCol,
|
|
int valueStart,
|
|
int valueEnd,
|
|
int termStartCol,
|
|
int termEndCol
|
|
) {
|
|
// Only report terms from the location test function (test_locations)
|
|
// to keep the output focused.
|
|
t.getRegExp().getLocation().getStartLine() >= 142 and // test_locations starts here
|
|
t.getRegExp().getLocation().hasLocationInfo(_, _, litStartCol, _, _) and
|
|
valueStart = t.getStart() and
|
|
valueEnd = t.getEnd() and
|
|
t.hasLocationInfo(_, _, termStartCol, _, termEndCol)
|
|
}
|