[clang-tools-extra] Add support for renaming objc methods, even those with multiple selector pieces (PR #76466)
kadir çetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 24 05:04:09 PST 2024
================
@@ -543,6 +550,45 @@ std::optional<InvalidName> checkName(const NamedDecl &RenameDecl,
return Result;
}
+clangd::Range tokenRangeForLoc(ParsedAST &AST, SourceLocation TokLoc,
+ const SourceManager &SM,
+ const LangOptions &LangOpts) {
+ const auto *Token = AST.getTokens().spelledTokenAt(TokLoc);
+ assert(Token && "got inclusion at wrong offset");
+ clangd::Range Result;
+ Result.start = sourceLocToPosition(SM, Token->location());
+ Result.end = sourceLocToPosition(SM, Token->endLocation());
+ return Result;
+}
+
+// AST-based ObjC method rename, it renames all occurrences in the main file
+// even for selectors which may have multiple tokens.
----------------
kadircet wrote:
can we also define what `Locs` are, with a better name (like `SelectorOccurences`)?
https://github.com/llvm/llvm-project/pull/76466
More information about the cfe-commits
mailing list