The current implementation doesn't support merging declaration fragments at arbitrary offsets. This patch adds that support
by modifying declaration fragment methods.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/ExtractAPI/DeclarationFragments.h | ||
---|---|---|
102–120 | This shouldn't need to be part of the public interface of the DeclarationFragments type and can just be a static function in DeclarationFragments.cpp. | |
114 | Is this parameter intmax_t to allow negative indices? If so I really don't think it's a good idea. I would prefer if we exposed an iterator interface to DeclarationFragments to make the API more like that of a vector type. (The iterator would just need to be the iterator for the underlying vector). | |
clang/include/clang/ExtractAPI/ExtractAPIVisitor.h | ||
119 | I don't think the API naming makes it clear that you can and what it means to insert at a negative offset. I would much rather we had an iterator based interface and didn't necessarily do chained calls. It could look something like this: auto &DeclFrag = Record.second->Declaration; DeclFrag.insert(DeclFrag.begin(), "typedef", DeclarationGragments::FragmentKind::Keyword, "", nullptr); // the rest of the code |
- Updating D151048: [clang][ExtractAPI] Modify declaration fragment methods to add a new fragment at an arbitrary offset. #
- Enter a brief description of the changes included in this update.
- The first line is used as subject, next lines as comment. #
- If you intended to create a new revision, use:
- $ arc diff --create
I made all the suggested changes.
Is this parameter intmax_t to allow negative indices? If so I really don't think it's a good idea. I would prefer if we exposed an iterator interface to DeclarationFragments to make the API more like that of a vector type. (The iterator would just need to be the iterator for the underlying vector).