[PATCH] D112527: [clangd] Fix a hover crash on templated spaceship operator.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 26 07:18:36 PDT 2021


kadircet accepted this revision.
kadircet added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/Hover.cpp:271
+      DeclForComment = TSD->getSpecializedTemplate();
     if (const auto *TIP = TSD->getTemplateInstantiationPattern())
+      DeclForComment = TIP;
----------------
can we also turn these `if`s into `else if`s (similarly for `if`s at the top level) just to make sure we don't change behaviour (i suppose it should be fine, as the TIP will always be null in the case of undeclared specializations, but better safe than sorry).


================
Comment at: clang-tools-extra/clangd/Hover.cpp:286
+  // being instantiated from spasceship operater, which itself is a template
+  // instinstantiation the recursrive call is necessary.
+  if (D != DeclForComment)
----------------
s/instinstantiation/instantiation (unless you intentionally put a double `inst` :P)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112527



More information about the cfe-commits mailing list