[PATCH] D150124: [index][clangd] Consider labels when indexing function bodies

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 28 05:20:31 PDT 2023


kadircet added a comment.

sorry for missing this review. Nathan's explanation around `targetDecl` vs `findRefs` is absolutely right (btw, thanks a lot Nathan for taking good care of clangd, I don't think I say that enough). hopefully one day we can switch clangd's usage of libindex to our internal find target/explicitrefs implementation, but until then we actually need to address such things in both places to make sure functionality is actually consistent.



================
Comment at: clang/lib/Index/IndexBody.cpp:150
+                                    ParentDC,
+                                    unsigned(SymbolRole::NameReference));
+  }
----------------
nridge wrote:
> `NameReference` was introduced in https://github.com/llvm/llvm-project/commit/e7eb27a9a0edd859de49bcc9af7ca27dbb435886 to handle the somewhat unique situation with constructors and destructors where the constructor/destructor references the class by name but semantically denotes a separate entity.
> 
> Why is that applicable here?
> 
> Note that `handleReference()` will automatically add `SymbolRole::Reference` [here](https://searchfox.org/llvm/rev/cea72fe34194d58ac1ba9485ee9c9a63cf98a4e6/clang/lib/Index/IndexingContext.cpp#404).
+1 we shouldn't be setting namereference here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150124



More information about the cfe-commits mailing list