-
Notifications
You must be signed in to change notification settings - Fork 341
Add an API for clang dependency scanner to perform module lookup by name alone #3127
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, this is getting closer!
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the tests need a bit more work, they don't need to test unrelated functionality. Besides that, I only have a couple of small nits.
clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
Outdated
Show resolved
Hide resolved
…list of module and file dependencies of a module for a particular compiler invocation rdar://64538073
- Define a subclass of FrontendAction and call loadModule there. - Remove the API for creating a worker just for clang_experimental_DependencyScannerWorkerByModName_getFileDependencies_v1. - Add the capability to get the dependencies based on the module name to clang-scan-deps.
- Create a fake virtual source file instead of asking users to create one and pass it to the command line. - Remove the "translation-units" output from test case modules-full-by-mod-name.cpp. The information isn't useful as the source file name isn't passed on the command line in this case. - Inherit from `PreprocessOnlyAction`.
- Rebase. - Rename functions. - Remove unneeded test cases.
dca1536
to
3d4d75e
Compare
clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
Outdated
Show resolved
Hide resolved
clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
Outdated
Show resolved
Hide resolved
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
Outdated
Show resolved
Hide resolved
- Remove member `ModuleName` and thread it through functions. Remove member `FakeMemBuffer` too and make it a variable inside `computeDependencies`. - Use `MemoryBufferRef` instead of `MemoryBuffer *`. - Use `StringRef` instead of `const char *`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one last nit inline. Not sure how we usually treat PRs, but I think it'd be nice to squash the commits and give this PR more descriptive name.
clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
Outdated
Show resolved
Hide resolved
- Use Optional<String> as the type of ModuleName. - Add comments explaining what happens if the passed ModuleName isn't empty.
LGTM, thanks for working through this Akira! @Bigcheese, @hyp, @dexonsmith do you have any additional feedback? |
…ame alone (#3127) * [clang][clang-scan-deps] Add an experimental C API for returning the list of module and file dependencies of a module for a particular compiler invocation rdar://64538073 * Address review comments - Define a subclass of FrontendAction and call loadModule there. - Remove the API for creating a worker just for clang_experimental_DependencyScannerWorkerByModName_getFileDependencies_v1. - Add the capability to get the dependencies based on the module name to clang-scan-deps. * Address review comments - Create a fake virtual source file instead of asking users to create one and pass it to the command line. - Remove the "translation-units" output from test case modules-full-by-mod-name.cpp. The information isn't useful as the source file name isn't passed on the command line in this case. - Inherit from `PreprocessOnlyAction`. * Address review comments * Address review comments - Rebase. - Rename functions. - Remove unneeded test cases. * Address review comments - Remove member `ModuleName` and thread it through functions. Remove member `FakeMemBuffer` too and make it a variable inside `computeDependencies`. - Use `MemoryBufferRef` instead of `MemoryBuffer *`. - Use `StringRef` instead of `const char *`. * Address review comments - Use Optional<String> as the type of ModuleName. - Add comments explaining what happens if the passed ModuleName isn't empty. (cherry picked from commit 2a3e8df) Conflicts: clang/tools/libclang/libclang.map
Rebase onto
next
branch. The old pull request is here: #3099.