generated from cloudwego/.github
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: complete c parser #13
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
license-eye has totally checked 53 files.
Valid | Invalid | Ignored | Fixed |
---|---|---|---|
51 | 2 | 0 | 0 |
Click to see the invalid file list
- src/lang/cxx/lib.go
- src/lang/cxx/spec.go
resolve the conflicts first @Hoblovski |
1. Since clangd does not support semanticTokens/range method, use semanticTokens/full + filtering to emulate. 2. Since the concept of package and module does not apply to C/C++, treat the whole repo as a single package/module.
5011265
to
83847e7
Compare
AsterDY
reviewed
May 9, 2025
AsterDY
reviewed
May 9, 2025
AsterDY
reviewed
May 9, 2025
AsterDY
reviewed
May 9, 2025
AsterDY
reviewed
May 9, 2025
C allows symbols with the same name in a single module, provided either: * One is a weak symbol (decl) and one is a strong symbol (def) * They are both strong symbols, but never linked together. The first one works fine, but more changes are needed for the second one. testdata/cxxsimple illustrates the first scenario. Two instances of `myself` are present, one (weak) in `pair.h` and one (strong) in `pair.c`. The dependency is well defined in this scneario: 1. `pair.c:myself` depends on `pair.h:myself` 2. any other function using `myself` depends on both. To verify, run `./abcoder parse cxx testdata/cxxsimple > cxxsimple.json`. testdata/cxxduplicate is the second scenario. Two strong instances of `add` are present, each used in a different executable. clangd handles this with compile_commands.json. If clangd is invoked as below, the `main->add` dependency shall point to the `add` in `d1/add.c`. mkdir build && cd build && cmake .. bear -- make prog1 # generate compile_commands.json cd testdata/cduplicate && clangd-18 While clangd does the right job, the current implementation of scanning during collection does not take into account which files are included in a compilation (as specified in compile_commands.json). So `Collector.Collect` will incorrectly include `d2/add.c` even if it is not used, and mess up with dependencies. That is to say, even for the compilation `prog1 <- main.c, d1/add.c`, a dependency `main->d2/add.c:add` will be present.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
实现 C parser 到 AST。
考虑到 C 语言无模块,所以只有一个模块。
Check the PR title.
(Optional) Translate the PR title into Chinese.
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
zh(optional):
(Optional) Which issue(s) this PR fixes:
(optional) The PR that updates user documentation: