aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/ExtractAPI/API.cpp
AgeCommit message (Collapse)AuthorFilesLines
2022-12-13[clang][ExtractAPI] Add support for single symbol SGF and libclang supportDaniel Grumberg1-62/+123
This is mainly adding an entry point to `SymbolGraphSerializer` at `serializeSingleSymbolSGF` and exposing the necessary data to make this possible. Additionaly there are some changes to how symbol kinds and path components are serialized to make the usage more ergonomic in `serializeSingleSymbolSGF`. On the libclang side this introduces APIs to: - create an APISet from a TU - dispose of an APISet - query an APISet for a single symbol SGF for a given USR. - generate a single symbol SGF for a given CXCursor, this only traverses the necessary AST nodes to construct the result as oppposed as going through the entire AST. Differential Revision: https://reviews.llvm.org/D139115
2022-11-07Revert "Only add targetFallback if target is not in defined in current product"Daniel Grumberg1-33/+0
This was an accidental addition of a non-reviewed change. This reverts commit f63db9159bbbb0db98e13cb4440fdaa5c40e219b.
2022-11-07Only add targetFallback if target is not in defined in current productDaniel Grumberg1-0/+33
2022-08-19[clang][ExtractAPI] Record availability information on all platformsDaniel Grumberg1-54/+64
Currently ExtractAPI only emits availability information for the current platform. This makes it easy for clients to get all availability information for a given symbol in one invocation as opposed to having to invoke clang once per-platform and then merge the symbol-graphs. Differential Revision: https://reviews.llvm.org/D130918
2022-04-12[clang][extract-api] Add support for true anonymous enumsDaniel Grumberg1-18/+18
Anonymous enums without a typedef should have a "(anonymous)" identifier. Differential Revision: https://reviews.llvm.org/D123533
2022-04-11[clang][extract-api] Emit "functionSignature" in SGF for ObjC methods.Daniel Grumberg1-23/+12
- Split GlobalRecord into two distinct types to be able to introduce has_function_signature type trait. - Add has_function_signature type trait. - Serialize function signatures as part of serializeAPIRecord for records that are known to have a function signature. Differential Revision: https://reviews.llvm.org/D123304
2022-04-06[clang][extract-api] Add Objective-C Category supportZixu Wang1-0/+19
Add (partial) support for Objective-C category records in ExtractAPI. The current ExtractAPI collects everything for an Objective-C category, but not fully serialized in the SymbolGraphSerializer. Categories extending external interfaces are disgarded during serialization, and categories extending known interfaces are merged (all members surfaced) into the interfaces. Differential Revision: https://reviews.llvm.org/D122774
2022-04-06[clang][extract-api] Add support for typedefsDaniel Grumberg1-0/+12
Typedef records consist of the symbol associated with the underlying TypedefDecl and a SymbolReference to the underlying type. Additionally typedefs for anonymous TagTypes use the typedef'd name as the symbol name in their respective records and USRs. As a result the declaration fragments for the anonymous TagType are those for the associated typedef. This means that when the user is defining a typedef to a typedef to a anonymous type, we use a reference the anonymous TagType itself and do not emit the typedef to the anonymous type in the generated symbol graph, including in the type destination of further typedef symbol records. Differential Revision: https://reviews.llvm.org/D123019
2022-03-30[clang][extract-api] Add support for macrosDaniel Grumberg1-42/+45
To achieve this we hook into the preprocessor during the ExtractAPIAction and record definitions for macros that don't get undefined during preprocessing.
2022-03-29[clang][extract-api] Add Objective-C protocol supportZixu Wang1-0/+15
Add support for Objective-C protocol declarations in ExtractAPI. Depends on D122446 Differential Revision: https://reviews.llvm.org/D122511
2022-03-29[clang][extract-api] Add Objective-C interface supportZixu Wang1-0/+58
Add support for Objective-C interface declarations in ExtractAPI. Depends on D122495 Differential Revision: https://reviews.llvm.org/D122446
2022-03-24[NFC][clang][extract-api] Add missing virtual anchorsZixu Wang1-0/+4
Add missing virtual method anchors for structs in ExtractAPI/API.h
2022-03-24[clang][extract-api] Stop allocating APIRecords via BumpPtrAllocatorDaniel Grumberg1-15/+13
Using a BumpPtrAllocator introduced memory leaks for APIRecords as they contain a std::vector. This meant that we needed to always keep a reference to the records in APISet and arrange for their destructor to get called appropriately. This was further complicated by the need for records to own sub-records as these subrecords would still need to be allocated via the BumpPtrAllocator and the owning record would now need to arrange for the destructor of its subrecords to be called appropriately. Since APIRecords contain a std::vector so whenever elements get added to that there is an associated heap allocation regardless. Since performance isn't currently our main priority it makes sense to use regular unique_ptr to keep track of APIRecords, this way we don't need to arrange for destructors to get called. The BumpPtrAllocator is still used for strings such as USRs so that we can easily de-duplicate them as necessary. Differential Revision: https://reviews.llvm.org/D122331
2022-03-23[clang][extract-api] Add struct supportZixu Wang1-0/+27
- Add `StructFieldRecord` and `StructRecord` to store API information for structs - Implement `VisitRecordDecl` in `ExtractAPIVisitor` - Implement Symbol Graph serialization for struct records. - Add test case for struct records. Depends on D121873 Differential Revision: https://reviews.llvm.org/D122202
2022-03-23[clang][extract-api] Add enum supportZixu Wang1-0/+25
Add support for enum records - Add `EnumConstantRecord` and `EnumRecord` to store API information for enums - Implement `VisitEnumDecl` in `ExtractAPIVisitor` - Implement serializatin for enum records and `MemberOf` relationship - Add test case for enum records - Few other improvements Depends on D122160 Differential Revision: https://reviews.llvm.org/D121873
2022-03-22[clang][extract-api] Refactor ExtractAPI and improve docsZixu Wang1-0/+83
- The name SymbolGraph is inappropriate and confusing for the new library for clang-extract-api. Refactor and rename things to make it clear that ExtractAPI is the core functionality and SymbolGraph is one serializer for the API information. - Add documentation comments to ExtractAPI classes and methods to improve readability and clearness of the ExtractAPI work. Differential Revision: https://reviews.llvm.org/D122160