[clang][ExtractAPI] Refactor ExtractAPIVisitor to make it more extensible
authorDaniel Grumberg <dgrumberg@apple.com>
Wed, 22 Mar 2023 18:50:59 +0000 (18:50 +0000)
committerDaniel Grumberg <dgrumberg@apple.com>
Mon, 27 Mar 2023 16:24:10 +0000 (17:24 +0100)
commit21750a1ae8c86ffefc72f115116c80a98a0792dc
tree8d0cca588fd81dfb11b387bfb350566935a88595
parentea35740e7e189cdcdd88344ac60a53a5b8a8318d
[clang][ExtractAPI] Refactor ExtractAPIVisitor to make it more extensible

Use CRTP to enable creating statically dispatched subclasses of
ExtractAPIVisitor.
This enables adding extension points and customising the behavior more
easily.

This is used in CXExtractAPI.cpp to create a specialized visitor for
Libclang as well as streamlining the batch implementation in ExtractAPIConsumer.cpp

[clang][ExtractAPI] Improve tests for clang_getSymbolGraphForCursor

Adds a new mode to c-index-test that can fetch a single symbol symbol
graph for a given source location. This way we can be more precise when
writing tests for clang_getSymbolGraphForCursor.
Additionaly this makes it easier to debug the function.

Differential Revision: https://reviews.llvm.org/D146656
clang/test/Index/extract-api-cursor.m
clang/tools/c-index-test/c-index-test.c