[all-commits] [llvm/llvm-project] 805f7a: [clang] Add `ObjCProtocolLoc` to represent protoco...

David Goldman via All-commits all-commits at lists.llvm.org
Fri Feb 18 12:25:22 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 805f7a4fa4ce97277c3b73d0c204fc3aa4b072e1
      https://github.com/llvm/llvm-project/commit/805f7a4fa4ce97277c3b73d0c204fc3aa4b072e1
  Author: David Goldman <davg at google.com>
  Date:   2022-02-18 (Fri, 18 Feb 2022)

  Changed paths:
    M clang/include/clang/AST/ASTFwd.h
    M clang/include/clang/AST/ASTTypeTraits.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/AST/TypeLoc.h
    M clang/lib/AST/ASTTypeTraits.cpp
    M clang/lib/AST/ParentMapContext.cpp
    M clang/unittests/AST/RecursiveASTVisitorTest.cpp

  Log Message:
  -----------
  [clang] Add `ObjCProtocolLoc` to represent protocol references

Add `ObjCProtocolLoc` which behaves like `TypeLoc` but for
`ObjCProtocolDecl` references.

RecursiveASTVisitor now synthesizes `ObjCProtocolLoc` during traversal
and the `ObjCProtocolLoc` can be stored in a `DynTypedNode`.

In a follow up patch, I'll update clangd to make use of this
to properly support protocol references for hover + goto definition.

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


  Commit: 54a962bbfee86d5af90d5fdd39b4ff4ec8030f12
      https://github.com/llvm/llvm-project/commit/54a962bbfee86d5af90d5fdd39b4ff4ec8030f12
  Author: David Goldman <davg at google.com>
  Date:   2022-02-18 (Fri, 18 Feb 2022)

  Changed paths:
    M clang-tools-extra/clangd/FindTarget.cpp
    M clang-tools-extra/clangd/Selection.cpp
    M clang-tools-extra/clangd/unittests/FindTargetTests.cpp
    M clang-tools-extra/clangd/unittests/HoverTests.cpp

  Log Message:
  -----------
  [clangd] Use `ObjCProtocolLoc` for generalized ObjC protocol support

This removes clangd's existing workaround in favor of proper support
via the newly added `ObjCProtocolLoc`. This improves support by
allowing clangd to properly identify which protocol is selected
now that `ObjCProtocolLoc` gets its own ASTNode.

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


Compare: https://github.com/llvm/llvm-project/compare/0712c575b90a...54a962bbfee8


More information about the All-commits mailing list