[clang] Add `ObjCProtocolLoc` to represent protocol references
authorDavid Goldman <davg@google.com>
Wed, 9 Feb 2022 19:50:26 +0000 (14:50 -0500)
committerDavid Goldman <davg@google.com>
Fri, 18 Feb 2022 20:24:00 +0000 (15:24 -0500)
commit805f7a4fa4ce97277c3b73d0c204fc3aa4b072e1
tree4a0299b074e09d802be3482591b63cab191ea427
parent0712c575b90a7eb508bf43d15c38c1c0b0d69695
[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
clang/include/clang/AST/ASTFwd.h
clang/include/clang/AST/ASTTypeTraits.h
clang/include/clang/AST/RecursiveASTVisitor.h
clang/include/clang/AST/TypeLoc.h
clang/lib/AST/ASTTypeTraits.cpp
clang/lib/AST/ParentMapContext.cpp
clang/unittests/AST/RecursiveASTVisitorTest.cpp