This diff changes bugprone-stringview-nullptr in the following ways:
- Adds support for return statements, with new tests
- Adds support for arbitrary T constructor calls that have string_view parameter type, with new tests
- Adds filtering in the heavily re-used BasicStringViewConstructingFromNullExpr matcher to prevent collision with CXXTemporaryObjectExpr
- Switches the implementation of BasicStringViewConstructingFromNullExpr to use hasAnyArgument instead of hasArgument to avoid the automated "skip" that the latter performs on parens and implicit casts
- Adds the isDirectInitialization matcher to distinguish direct and copy variable declarations
- Constraints variable declarations (and similar) to ensure only basic_string_view initialization is matched
- Simplifies matching on function call expressions by only editing a single parameter at a time. Re-running the tool and applying the edits each time will allow it to catch multiple arguments in the same function call, in the rare case that is needed.
In these cases, what is special about return? I'd guess the AST has various implicit nodes inserted, but then might it make more sense to focus on those as the pattern? Or, is the edit different based on the return context? Might be worth explaining this more in a comment?