[all-commits] [llvm/llvm-project] e8f4a0: [clangd] Fix a hover crash on templated spaceship ...

Adam Czachorowski via All-commits all-commits at lists.llvm.org
Tue Oct 26 08:31:29 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e8f4a01189143854f30e2bb622baa729a42f152d
      https://github.com/llvm/llvm-project/commit/e8f4a01189143854f30e2bb622baa729a42f152d
  Author: Adam Czachorowski <adamcz at google.com>
  Date:   2021-10-26 (Tue, 26 Oct 2021)

  Changed paths:
    M clang-tools-extra/clangd/Hover.cpp
    M clang-tools-extra/clangd/unittests/HoverTests.cpp

  Log Message:
  -----------
  [clangd] Fix a hover crash on templated spaceship operator.

We make assumption that:
getDeclForComment(getDeclForComment(X)) == getDeclForComment(X)
but this is not true if you have a template
instantionation of a template instantiation, which is the case when, for
example, you have a <=> operator in a templated class.

This fix makes getDeclForComment() call itself recursively to ensure
this property is always true.

Fixes https://github.com/clangd/clangd/issues/901

Differential Revision: https://reviews.llvm.org/D112527




More information about the All-commits mailing list