Files
codeql/cpp
copilot-swe-agent[bot] 52b35ef08e Commit 2: Adapt Ruby regex library to compile against C++
Changes from verbatim Ruby baseline (Commit 1) to compilable C++:

ParseRegExp.qll:
- Remove: private import codeql.ruby.AST as Ast
- Remove: private import codeql.Locations
- Add: private import semmle.code.cpp.exprs.Literal
- Change RegExp base: Ast::StringlikeLiteral -> StringLiteral
- Replace getText(): removes getConstantValue() Ruby accessor, uses getValue()
  (C++ StringLiteral.getValue() returns the string content, analogous to
   Ruby's getConstantValue().getString())

RegexTreeView.qll:
- Remove Ruby-specific imports (codeql.ruby.AST, codeql.Locations,
  codeql.regex.nfa.NfaUtils)
- Add: private import semmle.code.cpp.exprs.Literal
- Keep: codeql.util.Numbers (for parseHexInt in RegExpEscape.getUnicode())
- Keep: codeql.regex.RegexTreeView (satisfies RegexTreeViewSig)
- Change getParsedRegExp: Ast::RegExpLiteral -> StringLiteral
- Simplify hasLocationInfo to use re.getLocation() directly with +1 offset
  for opening quote (approximate; fixed in commits 8-9)
- Replace isExcluded: remove hasFreeSpacingFlag(), use none()
- Ruby dialect features preserved unchanged (\\A, \\z, \\G, \\h, etc.);
  dialect shift is commit 5

Test queries:
- parse.ql, regexp.ql: replace codeql.ruby.Regexp with
  semmle.code.cpp.regex.RegexTreeView
- .expected cleared (no test.cpp until commit 3)

Verified: both queries compile successfully with codeql query compile.
2026-07-21 10:08:22 +00:00
..
2024-04-16 16:29:56 +02:00