aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/ExtractAPI/Serialization
AgeCommit message (Collapse)AuthorFilesLines
2025-06-20[ExtractAPI] Include +/- symbols for ObjC methods (#145035)Prajwal Nadig1-0/+16
ObjC methods include a +/- prefix to indicate if they are a class or instance method. This information is valuable, and must be included in the navigator generated by ExtractAPI. rdar://150870936
2025-06-15[clang] Remove unused includes (NFC) (#144285)Kazu Hirata1-2/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2024-12-16[ExtractAPI] reorder the module names in extension symbol graph file names ↵QuietMisdreavus1-3/+2
(#119925) Resolves rdar://140298287 ExtractAPI's support for printing Objective-C category extensions from other modules emits symbol graphs with an `ExtendedModule@HostModule.symbols.json`. However, this is backwards from existing symbol graph practices, causing issues when these symbol graphs are consumed alongside symbol graphs generated with other tools like Swift. This PR flips the naming scheme to be in line with existing symbol graph tooling.
2024-10-28Remove support for RenderScript (#112916)Aaron Ballman1-1/+0
See https://discourse.llvm.org/t/rfc-deprecate-and-eventually-remove-renderscript-support/81284 for the RFC
2024-08-27[clang][ExtractAPI] Fix quirks in interaction with submodules (#105868)Daniel Grumberg1-2/+2
Extension SGFs require the module system to be enabled in order to discover which module defines the extended external type. This patch ensures the following: - Associate symbols with their top level module name, and that only top level modules are considered as modules for emitting extension SGFs. - Ensure we don't drop macro definitions that came from a submodule. To this end look at all defined macros in `PPCalbacks::EndOfMainFile` instead of relying on `PPCallbacks::MacroDefined` being called to detect a macro definition.
2024-08-20Reenable anon structs (#104922)Daniel Grumberg1-8/+0
Add back missing includes and revert revert "[clang][ExtractAPI] Stop dropping fields of nested anonymous record types when they aren't attached to variable declaration (#104600)"
2024-08-19Revert "[clang][ExtractAPI] Stop dropping fields of nested anonymous record ↵Daniel Grumberg1-0/+8
types when they aren't attached to variable declaration (#104600)" This reverts commit c60da1a271a6bb271e7703b2f7c71fbece67ab78.
2024-08-19[clang][ExtractAPI] Stop dropping fields of nested anonymous record types ↵Daniel Grumberg1-8/+0
when they aren't attached to variable declaration (#104600) - Introduce primitives for removing records from `APISet` and managing the record chain of `RecordContext` - Detect nested anonymous record types and remove them from the `APISet` after they have been fully traversed and transfer ownership of child records to the parent context (if any)
2024-08-15[clang][ExtractAPI] Emit environment component of target triple in SGF (#103273)Daniel Grumberg1-0/+4
rdar://133533830
2024-08-15[clang][ExtractAPI] Compute inherited availability information (#103040)Daniel Grumberg1-14/+17
Additionally this computes availability information for all platforms ahead of possibly introducing a flag to enable this behavior. rdar://123513706
2024-06-06[clang][NFC] fix name lookup for llvm::json::Value in SymbolGraphSerializer ↵Yuxuan Chen1-3/+2
(#94511) This code uses namespaces `llvm` and `llvm::json`. However, we have both `llvm::Value` and `llvm::json::Value`. Whenever any of the headers declare or include `llvm::Value`, the lookup becomes ambiguous. Fixing this by qualifying the `Value` type.
2024-05-20[clang][ExtractAPI] Remove symbols defined in categories to external types ↵Daniel Grumberg1-2/+9
unless requested (#92522) rdar://128259890
2024-05-13[clang][ExtractAPI] Distinguish between record kind for display and for RTTI ↵Daniel Grumberg1-3/+3
(#91466) rdar://127732562
2024-04-24[clang][ExtractAPI] Fix handling of anonymous TagDecls (#87772)Daniel Grumberg1-0/+8
This changes the handling of anonymous TagDecls to the following rules: - If the TagDecl is embedded in the declaration for some VarDecl (this is the only possibility for RecordDecls), then pretend the child decls belong to the VarDecl - If it's an EnumDecl proceed as we did previously, i.e., embed it in the enclosing DeclContext. Additionally this fixes a few issues with declaration fragments not consistently including "{ ... }" for anonymous TagDecls. To make testing these additions easier this patch fixes some text declaration fragments merging issues and updates tests accordingly. rdar://121436298
2024-04-23[clang][ExtractAPI] Serialize platform specific unavailable attribute in ↵Daniel Grumberg1-13/+15
symbol graphs (#89277) rdar://125622225
2024-04-03Reenable external categories (#87357)Daniel Grumberg1-564/+379
Reenables b31414bf4f9898f7817a9fcf8a91f62ec26f3eaf. Also adds a new warning for missing `--symbol-graph-dir` arg when `--emit-extension-symbol-graphs` is provided. This also reverts the commit that removed.
2024-04-02Revert "[clang][ExtractAPI] Add ability to create multiple symbol graphs ↵Daniel Grumberg1-379/+564
(#86676)" This failed the test suite due to missing DiagGroup for a new warning. This reverts commit b31414bf4f9898f7817a9fcf8a91f62ec26f3eaf.
2024-04-02[clang][ExtractAPI] Add ability to create multiple symbol graphs (#86676)Daniel Grumberg1-564/+379
This extends ExtractAPI to take into account symbols defined in categories to types defined in an external module. This introduces 2 new command line flags, `--symbol-graph-dir=DIR` and `--emit-extension-symbol-graphs`, when used together this generates additional symbol graph files at `DIR/ExtendedModule@ProductName.symbols.json` for each external module that is extended in this way. Additionally this makes some cleanups to tests to make them more resilient and cleans up the `APISet` data structure.
2024-03-21[CIR][Basic][NFC] Add the CIR language to the Language enumNathan Lanza1-0/+1
Add the CIR language to the Language enum and the standard usages of it. commit-id:fd12b2c2 Reviewers: bcardosolopes, AaronBallman, erichkeane Reviewed By: AaronBallman, bcardosolopes Pull Request: https://github.com/llvm/llvm-project/pull/86072
2024-01-22[clang][ExtractAPI] Add support C unions in non C++ parsing mode (#77451)Daniel Grumberg1-6/+12
Ensure that we generate correct symbol kinds and declaration fragments for unions in C and Objective-C parsing modes. rdar://120544091
2024-01-19[clang][ExtractAPI] Record availability information only for the target ↵Sofía Rodríguez1-31/+25
platform (#76823) Currently, ExtractAPI provides availability information for all platforms within a given domain. With this change, we narrow down the output to include availability details only for the specified target platform, so users can generate the symbol graph with only the availability information they need, omitting information of the other platforms. This change reverts the functionality introduced in [`57c9780`](https://github.com/llvm/llvm-project/commit/57c9780). rdar://120419037
2023-12-13[clang] Use StringRef::{starts,ends}_with (NFC) (#75149)Kazu Hirata1-1/+1
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. I'm planning to deprecate and eventually remove StringRef::{starts,ends}with.
2023-12-07[clang][ExtractAPI] Allow serialization for ObjC++ headers (#74733)Daniel Grumberg1-1/+2
rdar://79874441
2023-11-14ExtractAPI: use zero-based indices for line/column in symbol graph (#71753)QuietMisdreavus1-2/+2
Other implementations of the symbol graph format use zero-based indices for source locations, which causes problems when combined with clang's current one-based indices. This commit sets ExtractAPI's symbol graph output to use zero-based indices to align with other implementations. rdar://107639783
2023-11-07[clang][ExtractAPI] Update availability serialization in SGF (#71418)Daniel Grumberg1-3/+3
The prevailiing symbol graph parsing library expects availability attributes to just be "introduced" instead of "introducedVersion" rdar://117823923
2023-09-28[NFC][CLANG] Fix static analyzer bugs about unnecessary object copies with autoManna, Soumi1-4/+4
Reviewed By: tahonermann Differential Revision: https://reviews.llvm.org/D159474
2023-09-08[clang] Prevent unnecessary copies in `SymbolGraphSerializer` (NFC)Antonio Frighetto1-2/+2
2023-08-22[clang][ExtractAPI] Add support for namespacesErick Velez1-0/+27
Serialize namespaces, nested namespaces, and class relationships inside them. Depends on D157076 Reviewed By: dang Differential Revision: https://reviews.llvm.org/D158239
2023-08-21[clang][ExtractAPI] Refactor C++ method and field visitationErick Velez1-10/+33
Refactor visitation for C++ record children by following the Visitor's CRTP. Expand VisitCXXField, VisitCXXMethod for non-templates and introduce VisitCXXConstructor, VisitCXXDestructor. Handle relationships by finding the parent's Record via USR from DeclContext. Depends on D158029 Reviewed By: dang Differential Revision: https://reviews.llvm.org/D158031
2023-08-21[clang][ExtractAPI] Add support for C++ member templatesErick Velez1-0/+17
Visit and serialize C++ fields by checking if a var template's context is a CXXRecordDecl in VisitVarTemplateDecl. Depends on D158027 Reviewed By: dang Differential Revision: https://reviews.llvm.org/D158029
2023-08-21[clang][ExtractAPI] Visit method templates with better schemeErick Velez1-0/+34
Visit and serialize method templates and template specializations. Introduces a new scheme of visiting child Decls via VisitCXXMethodDecl which will be followed in future patches for Fields and non-template methods. Depends on D157579 Reviewed By: dang Differential Revision: https://reviews.llvm.org/D158027
2023-08-18[clang][ExtractAPI] Add support for C++ global function templatesErick Velez1-0/+24
Add records, serialization for global function templates and their specializations Depends on D157350 Reviewed By: dang Differential Revision: https://reviews.llvm.org/D157579
2023-08-18[clang][ExtractAPI] Add support for C++ variable templatesErick Velez1-0/+37
Serialize global C++ variable templates and specializations. Depends on D157076 Reviewed By: dang Differential Revision: https://reviews.llvm.org/D157350
2023-08-18[clang][ExtractAPI] Add support for C++ class templates and conceptsErick Velez1-0/+114
Add has_template template, DeclarationFragmentBuilder functions, and tests for class templates, specializations/partial specs, and concepts. Depends on D157007 Reviewed By: dang Differential Revision: https://reviews.llvm.org/D157076
2023-08-16Simplify a conditional in order to avoid a warning under MSVCJustin Bogner1-1/+1
We were using some convoluted logic here to check if the result of a `bool` returning function was false, causing MSVC to give a warning about "'>': unsafe use of type 'bool' in operation". This just removes the greater-than comparison of the bool against zero.
2023-08-15[clang][ExtractAPI] Add support for Objective-C categoriesruturaj41-13/+65
Differential Revision: https://reviews.llvm.org/D152770
2023-08-04[clang][ExtractAPI] Add support for C++ classes with fixErick Velez1-5/+96
Reintroduce D153557 with fix for use-after-free from f4de606ef271 and minor changes. Reviewed By: dang Differential Revision: https://reviews.llvm.org/D157007
2023-08-02Revert "[clang][ExtractAPI] Add support for C++ classes"Erick Velez1-96/+5
This reverts commit 8b76b44e46ac5b4efbf8cb3702f09d353af2a112.
2023-08-02[clang][ExtractAPI] Add support for C++ classesErick Velez1-5/+96
Add ExtractAPI support C++ classes, fields, methods, and various qualifiers and specifiers Differential Revision: https://reviews.llvm.org/D153557
2023-05-30[clang][ExtractAPI] Refactor serializer to the CRTPErick Velez2-76/+20
Refactor SerializerBase and SymbolGraphSerializer to use a visitor pattern described by the CRTP. Reviewed By: dang Differential Revision: https://reviews.llvm.org/D151477
2023-03-30[clang][ExtractAPI] Reland ExtractAPI for libclang improvementsDaniel Grumberg1-4/+0
This relands the changes that were originally introduced by: - https://reviews.llvm.org/D146656 - https://reviews.llvm.org/D147138 This also fixes the leak that led to these changes being reverted Differential Revision: https://reviews.llvm.org/D147234
2023-03-29Revert "[clang][ExtractAPI] Add queried symbol to parent contexts in libclang"Mitch Phillips1-0/+4
This reverts commit 1cfe1e732ad8e8148f6fa8fc0f0c86f4b965d567. Depends on reverted commit 158a431227a876306fe5838936413dd51588d0c6. See https://reviews.llvm.org/rG79116475124112051625b1a0665e35c861bb13fd for more information, this broke the ASan bots.
2023-03-29[clang][ExtractAPI] Add queried symbol to parent contexts in libclangDaniel Grumberg1-4/+0
Ensure that the current symbol is added to the parent contexts in the output of libclang function for generating symbol graphs for single symbols. Differential Revision: https://reviews.llvm.org/D147138
2023-03-02[clang][ExtractAPI] Handle platform specific unavailability correctlyAnkur1-6/+10
This Patch gives ExtractAPI the ability to emit correct availability information for symbols marked as unavailable on a specific platform ( PR#60954 ) Reviewed By: dang Differential Revision: https://reviews.llvm.org/D144940
2023-02-10[clang] [extract-api] Don't crash for category in libclang APIsDaniel Grumberg1-9/+19
Remove failure conditions for categories in libclang and return empty content instead. Differential Revision: https://reviews.llvm.org/D142101
2023-01-14[clang] Use std::optional instead of llvm::Optional (NFC)Kazu Hirata1-12/+14
This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to remove #include "llvm/ADT/Optional.h". This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14[clang] Add #include <optional> (NFC)Kazu Hirata1-0/+1
This patch adds #include <optional> to those files containing llvm::Optional<...> or Optional<...>. I'll post a separate patch to actually replace llvm::Optional with std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-17llvm::Optional::value => operator*/operator->Fangrui Song1-2/+2
std::optional::value() has undesired exception checking semantics and is unavailable in older Xcode (see _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS). The call sites block std::optional migration. This makes `ninja clang` work in the absence of llvm::Optional::value.
2022-12-13[clang][ExtractAPI] Add support for single symbol SGF and libclang supportDaniel Grumberg1-44/+219
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-12-09[clang] Use std::nullopt instead of None in comments (NFC)Kazu Hirata1-9/+9
This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716