This is in preparation for implementing doxygen parsing, see discussion in https://github.com/clangd/clangd/issues/529.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/AST/RawCommentList.h | ||
---|---|---|
159 ↗ | (On Diff #494076) | Not sure if this is the right place for this? Could be moved to FullComment or made a free function instead? |
clang/lib/AST/RawCommentList.cpp | ||
227 ↗ | (On Diff #494076) | I wasn't sure if it's worth making the Diagnostics parameter optional here - Our SourceMgr already has it anyway, does it impact performance significantly to use it, even though we don't need it (yet)? |
Thanks, this looks like a good start. I left some comments about the details of implementation, as for placing and APIs in general, i think it's useful to see how things will be built on top inside clangd to make the right call here.
clang/include/clang/AST/RawCommentList.h | ||
---|---|---|
159 ↗ | (On Diff #494076) | i think this would make more sense inside clangd as a free function when we're processing comments. it's nice to get to re-use some Lexer/Sema/Parser creation logic, but i don't think it's big enough to justify a new public interfaces that's solely used by clangd. |
clang/lib/AST/RawCommentList.cpp | ||
227 ↗ | (On Diff #494076) | as things stand, Lexer, Sema and Parser expect a non-null diagnosticsengine so we have to pass something (i guess that's what you meant by making it optional). the performance implications comes from two places: i don't know how costly the first action is today, it's unfortunately the case that would require a lot of code changes, if it's happening quite often in practice (especially when we're in codebases without proper doxygen comments) i think taking a look at the codebase for the first (searching for Diag(...) << patterns in Comment{Lexer,Sema,Parser}.cpp should give some ideas) and assessing whether we're performing any extra complicated analysis would be a good start. i would expect us not to, and if that's the case i think we can leave it at that and don't try to make code changes. |
- Move to free function in CodeCompletionStrings.h
- Add back comment markers before parsing (Index stores comments without markers, but the comment lexer expects them)
clang/lib/AST/RawCommentList.cpp | ||
---|---|---|
227 ↗ | (On Diff #494076) | 1 - At first glance it indeed seems like there's no significant extra analysis performed, so I think we're good for now. |