Add new --emit-symbol-graph=<DIR> option which generates ExtractAPI symbol
graph information of .c/.m files on regular compilation job and put them in
the provided "DIR" directory.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/test/ExtractAPI/emit-symbol-graph/multi_file.c | ||
---|---|---|
9 | I was a bit confused as to whether call the front end or the entire driver so currently I have created 2 different tests one for each. I called the driver here because it saved me an extra step of linking the standard library here. |
clang/test/ExtractAPI/emit-symbol-graph/multi_file.c | ||
---|---|---|
9 |
The current tests only test if the generated symbol-graphs are correct or not, and does not check if the output file was generated or not, What would be a good way to test for the regular output file. |
clang/include/clang/ExtractAPI/FrontendActions.h | ||
---|---|---|
20 | Is this include needed here? If not it should go in the cpp file | |
114 | ||
clang/lib/ExtractAPI/ExtractAPIConsumer.cpp | ||
455 | I am not sure if the base class is the best place to put this logic in. Maybe it would make sense to have a separate implementation for the two derived classes. | |
597 | I am not sure this does exactly what we want from this. We are hoping to get symbols that come from project headers here as well. I think that this would constrain the visitor to only record symbols that came from the input files themselves. | |
clang/test/ExtractAPI/emit-symbol-graph/multi_file.c | ||
9 | I don't think the -Xclangs are needed here. |
clang/test/ExtractAPI/emit-symbol-graph/multi_file.c | ||
---|---|---|
9 | when I don't use "-Xclang" on my local machine, clang doesn't generate the required output and complaints about unused arguments. |
- now "--emit-symbol-garph" should emit all the symbols (even the ones external to the input files)
- update tests accordingly
- did changes as suggested in the last review
- move ExtractAPIBase to it's own seperate file
- remove ExtractAPIBase::CreateExtractAPIConsumer(), consumer generation is now managed by the derived class.
- New BasicExtractAPIVisitor for including all the decls when visiting AST ( used by WrappingExtractAPIVisitor )
- New SymbolGraphConsumer for more general symbol graph generation ( emmit all the symbols )
- Refactor MacroCallBack for more general case
- New APIMacroCallBack for cases where symbol graph is generated for API information of a library ( filter out symbols from external files )
clang/include/clang/ExtractAPI/ExtractAPIActionBase.h | ||
---|---|---|
26 | ||
clang/lib/ExtractAPI/ExtractAPIConsumer.cpp | ||
227 | I don't think this is needed ExtractAPIVisitor was written so that it could be used as is. If it isn't then it's a bug we should fix. | |
250 | Not sure I like the name SymbolGraphConsumer, but I don't have a great suggestion, maybe WrappingExtractAPIConsumer so that at least it's clear that it is intended to be used by WrappingExtractAPIAction? | |
280 | the name change here is unnecessary | |
562–570 | I don't think we need to do all this computation since we just serialize symbol graphs for all symbols. |
Changes majorly include fixing issues pointed out by review comments :
- Remove WrappingExtractAPIAction::prepareToExecuteAction()
- Move knownInputFiles from Base action to ExtractAPIFrontendAction
- Fix naming of MacroCallback and symbolGraphConsumer
- Fix minor typos
- Remove BasicExtractAPIVisitor, directly use ExtractAPIVisitor instead