Commit 8: Complete location-test coverage for u8 and u8R forms

Add u8"..." and u8R"(...)" cases to test_locations in test.cpp, guarded
by #if __cplusplus >= 201703L. Add an options file forcing
-std=c++17 so the u8 char8_t-era rows are actually extracted.

Plain "..." rows are unchanged. New u8/u8R rows in locations.expected
show correct columns computed by regexpContentOffset: offset 3 for
`u8"` and offset 5 for `u8R"(`. No change to regexpContentOffset was
needed.

Bundle: github/codeql-action codeql-bundle-v2.26.1 (CodeQL CLI 2.26.1).
This commit is contained in:
copilot-swe-agent[bot]
2026-07-21 12:27:34 +00:00
committed by GitHub
parent 633ba01b77
commit 2f01e133b9
5 changed files with 51 additions and 0 deletions

View File

@@ -94,3 +94,11 @@
| test.cpp:196:22:196:25 | a\\.b | 21 | 0 | 4 | 22 | 25 |
| test.cpp:196:23:196:24 | \\. | 21 | 1 | 3 | 23 | 24 |
| test.cpp:196:25:196:25 | b | 21 | 3 | 4 | 25 | 25 |
| test.cpp:200:22:200:22 | a | 19 | 0 | 1 | 22 | 22 |
| test.cpp:200:22:200:23 | a+ | 19 | 0 | 2 | 22 | 23 |
| test.cpp:200:22:200:24 | a+b | 19 | 0 | 3 | 22 | 24 |
| test.cpp:200:24:200:24 | b | 19 | 2 | 3 | 24 | 24 |
| test.cpp:203:28:203:28 | a | 23 | 0 | 1 | 28 | 28 |
| test.cpp:203:28:203:29 | a+ | 23 | 0 | 2 | 28 | 29 |
| test.cpp:203:28:203:30 | a+b | 23 | 0 | 3 | 28 | 30 |
| test.cpp:203:30:203:30 | b | 23 | 2 | 3 | 30 | 30 |

View File

@@ -0,0 +1 @@
semmle-extractor-options: -std=c++17

View File

@@ -861,3 +861,25 @@ test.cpp:
# 196| [RegExpConstant, RegExpEscape] \.
# 196| [RegExpConstant, RegExpNormalChar] b
# 200| [RegExpConstant, RegExpNormalChar] a
# 200| [RegExpPlus] a+
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
# 200| [RegExpSequence] a+b
#-----| 0 -> [RegExpPlus] a+
#-----| 1 -> [RegExpConstant, RegExpNormalChar] b
# 200| [RegExpConstant, RegExpNormalChar] b
# 203| [RegExpConstant, RegExpNormalChar] a
# 203| [RegExpPlus] a+
#-----| 0 -> [RegExpConstant, RegExpNormalChar] a
# 203| [RegExpSequence] a+b
#-----| 0 -> [RegExpPlus] a+
#-----| 1 -> [RegExpConstant, RegExpNormalChar] b
# 203| [RegExpConstant, RegExpNormalChar] b

View File

@@ -323,6 +323,14 @@ term
| test.cpp:196:22:196:25 | a\\.b | RegExpSequence |
| test.cpp:196:23:196:24 | \\. | RegExpConstant,RegExpEscape |
| test.cpp:196:25:196:25 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:200:22:200:22 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:200:22:200:23 | a+ | RegExpPlus |
| test.cpp:200:22:200:24 | a+b | RegExpSequence |
| test.cpp:200:24:200:24 | b | RegExpConstant,RegExpNormalChar |
| test.cpp:203:28:203:28 | a | RegExpConstant,RegExpNormalChar |
| test.cpp:203:28:203:29 | a+ | RegExpPlus |
| test.cpp:203:28:203:30 | a+b | RegExpSequence |
| test.cpp:203:30:203:30 | b | RegExpConstant,RegExpNormalChar |
regExpNormalCharValue
| test.cpp:33:21:33:23 | abc | abc |
| test.cpp:36:22:36:22 | a | a |
@@ -461,3 +469,7 @@ regExpNormalCharValue
| test.cpp:196:22:196:22 | a | a |
| test.cpp:196:23:196:24 | \\. | . |
| test.cpp:196:25:196:25 | b | b |
| test.cpp:200:22:200:22 | a | a |
| test.cpp:200:24:200:24 | b | b |
| test.cpp:203:28:203:28 | a | a |
| test.cpp:203:30:203:30 | b | b |

View File

@@ -194,4 +194,12 @@ void test_locations() {
// Escape with dot — "a\\.b" value is a\.b; offset 1 correct
std::regex r_esc2("a\\.b");
// u8 encoding prefix — content offset 3 (u8" = 3 chars). Requires C++17+.
#if __cplusplus >= 201703L
std::regex r_u8(u8"a+b");
// u8R raw — content offset 5 (u8R"( = 5 chars).
std::regex r_u8_raw(u8R"(a+b)");
#endif
}