Files
codeql/cpp/ql
copilot-swe-agent[bot] bfa65301f1 Commit 9: Fix hasLocationInfo for all string literal forms; fix unicode escape
RegexTreeView.qll - hasLocationInfo fix (RULE 4):
- Add regexpContentOffset(RegExp re) private helper that computes the correct
  number of source chars before the first content char, from getValueText():
  - Plain "...":          offset 1
  - L"...":               offset 2 (L" prefix)
  - u8"...":              offset 3 (u8" prefix)
  - R"(...)":             offset 3 (R"( opener)
  - R"x(...)x":          offset 4 (R"x( with custom delim)
  - LR"(...)":            offset 4 (LR"()
  - Uses vt.matches("%R\"%(%") to detect raw strings; finds '(' position
  - For non-raw, finds '"' position
- Replace hardcoded `+ 1` with `+ regexpContentOffset(re)` in hasLocationInfo
- Update comment: documents plain/encoding/raw/combined forms, notes that
  escaped non-raw strings are approximate (mirroring Java/Python)

test.cpp:
- Fix r_uni: change "\\u{9879}" to "\\u9879" — braced \u{...} is not standard
  C++ regex syntax; the 4-digit \uHHHH form is valid ECMAScript \u escape

Regenerated all 3 .expected files via codeql test run --learn (CodeQL 2.26.1).
All 3 tests pass.

Location test confirms:
- Plain "a+b" (line 144): litStartCol 22 → termStartCol 23 (22+1)  UNCHANGED ✓
- Raw R"(a+b)" (line 147): litStartCol 20 → termStartCol 23 (20+3)  FIXED ✓
- Raw R"x(a+b)x" (line 156): litStartCol 21 → termStartCol 25 (21+4) FIXED ✓
- L"a+b" (line 159): litStartCol 22 → termStartCol 24 (22+2)         FIXED ✓
- LR"(a+b)" (line 162): litStartCol 26 → termStartCol 30 (26+4)      FIXED ✓
2026-07-21 10:36:49 +00:00
..