[clang-tools-extra] [clang-tidy][clangd] Fixed removeFunctionArgs don't remove comma for use-ranges check (PR #118568)
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 13 12:00:48 PST 2025
================
@@ -164,6 +164,33 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) {
static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call,
ArrayRef<unsigned> Indexes,
const ASTContext &Ctx) {
+ auto GetCommaLoc =
+ [&](SourceLocation BeginLoc,
+ SourceLocation EndLoc) -> std::optional<CharSourceRange> {
+ auto Invalid = false;
+ StringRef SourceText = Lexer::getSourceText(
+ CharSourceRange::getCharRange({BeginLoc, EndLoc}),
+ Ctx.getSourceManager(), Ctx.getLangOpts(), &Invalid);
+ assert(!Invalid);
+
+ size_t I = 0;
+ while (I < SourceText.size() && SourceText[I] != ',') {
----------------
PiotrZSL wrote:
use [find_first_of](https://llvm.org/doxygen/classllvm_1_1StringRef.html#a93b15a8c0022febbe39d17ab933737a8)
https://github.com/llvm/llvm-project/pull/118568
More information about the cfe-commits
mailing list