Skip to content

SymbolGraph ExtractAPI support for C and Objective-C in clang #4442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
eea6ebc
[clang] Add an extract-api driver option
zixu-w Jan 20, 2022
96c71da
[FIX][clang] Fix unused private field in ExtractAPIVisitor
zixu-w Jan 27, 2022
4e30275
[clang][extract-api] Add global record support
zixu-w Feb 10, 2022
7784634
[FIX][clang-extract-api] Fix scope naming violation
zixu-w Mar 16, 2022
b307e9b
[FIX][NFC] Fix a test case in clang/SymbolGraph
zixu-w Mar 17, 2022
356c3e7
[NFC] Disable clang/SymbolGraph test
zixu-w Mar 17, 2022
0499c00
Ensure that APIRecords get destroyed correctly.
daniel-grumberg Mar 18, 2022
597d410
Ensure -extract-api handles multiple headers correctly
daniel-grumberg Mar 17, 2022
0ce2308
[clang][extract-api] Refactor ExtractAPI and improve docs
zixu-w Mar 21, 2022
e9638c9
[NFC][clang][extract-api] Use proper name string for Objective-C lang…
zixu-w Mar 22, 2022
fe7e923
[clang][extract-api] Suppprt for the module name property in SymbolGraph
daniel-grumberg Mar 16, 2022
657df3e
[clang][extract-api] Add enum support
zixu-w Mar 17, 2022
440253b
[clang][extract-api] Add struct support
zixu-w Mar 22, 2022
7a97865
[clang][extract-api] Enable processing of multiple headers
daniel-grumberg Mar 21, 2022
1679fc0
[clang][extract-api] Stop allocating APIRecords via BumpPtrAllocator
daniel-grumberg Mar 23, 2022
d4aaba4
[NFC][clang][extract-api] Add missing virtual anchors
zixu-w Mar 24, 2022
a1283c3
[NFC][clang][extract-api] Rename variable
zixu-w Mar 24, 2022
619b00b
[clang][extract-api] Use correct language info from inputs
zixu-w Mar 25, 2022
78f4dbb
[clang][extract-api] Add Objective-C interface support
zixu-w Mar 25, 2022
b990dab
[clang][extract-api] Add Objective-C protocol support
zixu-w Mar 25, 2022
5f97704
[clang][extractapi] Tie API and serialization to the FrontendAction
daniel-grumberg Mar 29, 2022
b5c70dc
[clang][extract-api] Add support for macros
daniel-grumberg Mar 29, 2022
dbf1b7c
[clang] Fix shared build. NFC.
darkbuck Mar 30, 2022
91f40b4
[clang][extract-api][NFC] Don't remap the generated input buffer in P…
daniel-grumberg Mar 30, 2022
efb4cf3
[clang][extract-api][NFC] Add documentation
daniel-grumberg Mar 31, 2022
7759bda
[clang][extract-api] Undefining macros should not result in a crash
daniel-grumberg Apr 4, 2022
f45d069
[clang][extract-api] Fix small issues with SymbolGraphSerializer
daniel-grumberg Apr 4, 2022
e2927c7
[clang][extract-api] Add support for typedefs
daniel-grumberg Apr 1, 2022
5531a19
[clang][extract-api] Add Objective-C Category support
zixu-w Mar 31, 2022
19bdd54
[clang][ExtractAPI] Fix appendSpace in DeclarationFragments
zixu-w Apr 6, 2022
3419ae9
[clang][extract-api] Process only APIs declared in inputs
daniel-grumberg Apr 5, 2022
d18be23
[clang][ExtractAPI] Fix declaration fragments for ObjC methods
zixu-w Apr 6, 2022
6176ef1
[clang][extract-api][NFC] Use dedicated API to check for macro equality
daniel-grumberg Apr 7, 2022
98eba13
[clang][extract-api] Emit "navigator" property of "name" in SymbolGraph
daniel-grumberg Apr 8, 2022
77b92f2
[clang][extract-api] Emit "functionSignature" in SGF for ObjC methods.
daniel-grumberg Apr 7, 2022
82cdb71
[clang][ExtractAPI][NFC] Fix sed delimiter in test
zixu-w Apr 11, 2022
2abd2c6
[clang][extract-api] Add support for true anonymous enums
daniel-grumberg Apr 11, 2022
41a110c
ExtractAPI: Use %clang_cc1 and -verify in enum.c
dexonsmith Apr 28, 2022
68e2737
[clang][extract-api] Use relative includes
zixu-w Apr 15, 2022
72157a8
[NFC] Remove unfinished test case
zixu-w May 4, 2022
5c2b3ab
Revert "[clang][extract-api] Use relative includes"
zixu-w May 4, 2022
2de6c52
Revert "Revert "[clang][extract-api] Use relative includes""
zixu-w May 4, 2022
553436e
[clang] Add static_cast to fix Bazel build.
akuegel May 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions clang/include/clang/AST/RawCommentList.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,21 @@ class RawComment {
std::string getFormattedText(const SourceManager &SourceMgr,
DiagnosticsEngine &Diags) const;

struct CommentLine {
std::string Text;
PresumedLoc Begin;
PresumedLoc End;

CommentLine(StringRef Text, PresumedLoc Begin, PresumedLoc End)
: Text(Text), Begin(Begin), End(End) {}
};

/// Returns sanitized comment text as separated lines with locations in
/// source, suitable for further processing and rendering requiring source
/// locations.
std::vector<CommentLine> getFormattedLines(const SourceManager &SourceMgr,
DiagnosticsEngine &Diags) const;

/// Parse the comment, assuming it is attached to decl \c D.
comments::FullComment *parse(const ASTContext &Context,
const Preprocessor *PP, const Decl *D) const;
Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ def err_test_module_file_extension_format : Error<
"-ftest-module-file-extension argument '%0' is not of the required form "
"'blockname:major:minor:hashed:user info'">;

def err_drv_extract_api_wrong_kind : Error<
"header file '%0' input '%1' does not match the type of prior input "
"in api extraction; use '-x %2' to override">;

def warn_slash_u_filename : Warning<"'/U%0' treated as the '/U' option">,
InGroup<DiagGroup<"slash-u-filename">>;
def note_use_dashdash : Note<
Expand Down
14 changes: 14 additions & 0 deletions clang/include/clang/Driver/Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Action {
PreprocessJobClass,
PrecompileJobClass,
HeaderModulePrecompileJobClass,
ExtractAPIJobClass,
AnalyzeJobClass,
MigrateJobClass,
CompileJobClass,
Expand Down Expand Up @@ -437,6 +438,19 @@ class HeaderModulePrecompileJobAction : public PrecompileJobAction {
const char *getModuleName() const { return ModuleName; }
};

class ExtractAPIJobAction : public JobAction {
void anchor() override;

public:
ExtractAPIJobAction(Action *Input, types::ID OutputType);

static bool classof(const Action *A) {
return A->getKind() == ExtractAPIJobClass;
}

void addHeaderInput(Action *Input) { getInputs().push_back(Input); }
};

class AnalyzeJobAction : public JobAction {
void anchor() override;

Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,10 @@ def emit_merged_ifs : Flag<["-"], "emit-merged-ifs">,
HelpText<"Generate Interface Stub Files, emit merged text not binary.">;
def interface_stub_version_EQ : JoinedOrSeparate<["-"], "interface-stub-version=">, Flags<[CC1Option]>;
def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
def extract_api : Flag<["-"], "extract-api">, Flags<[CC1Option]>, Group<Action_Group>,
HelpText<"Extract API information">;
def product_name_EQ: Joined<["--"], "product-name=">, Flags<[CC1Option]>,
MarshallingInfoString<FrontendOpts<"ProductName">>;
def e : JoinedOrSeparate<["-"], "e">, Flags<[LinkerInput]>, Group<Link_Group>;
def fmax_tokens_EQ : Joined<["-"], "fmax-tokens=">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Max total number of preprocessed tokens for -Wmax-tokens.">,
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Driver/Types.def
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,5 @@ TYPE("dSYM", dSYM, INVALID, "dSYM", phases
TYPE("dependencies", Dependencies, INVALID, "d", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("cuda-fatbin", CUDA_FATBIN, INVALID, "fatbin", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("hip-fatbin", HIP_FATBIN, INVALID, "hipfb", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("api-information", API_INFO, INVALID, "json", phases::Precompile)
TYPE("none", Nothing, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link)
Loading