[clang] [clang][ASTMatcher] Add `matchesString` for `StringLiteral` which matches literals on given `RegExp` (PR #102152)

via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 19:28:50 PDT 2024


Gitspike wrote:

> Thank you for this! I think we need to consider some more test cases though, because string literals aren't trivial. For example:
> 
> * Test the various string literal prefixes like `L` or `u`, etc. How should this work if the regular expression has a different encoding than the string literal?
> * Test string literals that have been concatenated, like `"fo""obar"` to make sure they also match a regex like `foo.*`.
> * Test string literals with embedded nulls to make sure the regex can still find matches after the null. e.g., `"foo\0bar"` as the string literal and `bar` as the regex.

Thank you for the suggestion, new test cases have been added.

https://github.com/llvm/llvm-project/pull/102152


More information about the cfe-commits mailing list