[PATCH] D133982: [clangd] Improve inlay hints of things expanded from macros

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 19 07:34:57 PDT 2022


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/InlayHints.cpp:281
 
-  void addReturnTypeHint(FunctionDecl *D, SourceLocation Loc) {
+  void addReturnTypeHint(FunctionDecl *D, SourceRange Range) {
     auto *AT = D->getReturnType()->getContainedAutoType();
----------------
nridge wrote:
> Is this change related to the fix?
Only tangentially...

This change makes the whole range significant (previously it was serialized but I think not used by any clients these days). So hiding the token->range conversion inside this function might encourage bugs in the future, even if today all the callers do that.

(I did consider attaching the return type hints to e.g. the parens range rather than a single paren, but can't think of a motivating case in either direction really)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133982/new/

https://reviews.llvm.org/D133982



More information about the cfe-commits mailing list