Skip to content

Commit

Permalink
Cxx: add a helper function for resetting kind, role, and scope
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Dec 3, 2022
1 parent 5400599 commit 0e49c79
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions parsers/cxx/cxx_tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,24 @@ void cxxTagUseTokensInRangeAsPartOfDefTags(int iCorkIndex, CXXToken * pFrom, CXX
}
}

void cxxTagResetRefTag(int iCorkIndex, int iScopeCorkIndex,
int iKindIndex, int iRoleIndex)
{
tagEntryInfo *pEntry = getEntryInCorkQueue(iCorkIndex);
if(pEntry == NULL)
return;
if (pEntry->placeholder)
return;

clearRoles(pEntry);
if(pEntry->extensionFields.scopeIndex != CORK_NIL)
unregisterEntry(iCorkIndex);
pEntry->extensionFields.scopeIndex = iScopeCorkIndex;
pEntry->kindIndex = iKindIndex;
assignRole(pEntry, iRoleIndex);
registerEntry(iCorkIndex);
}

static bool countSameKindEntry(int corkIndex,
tagEntryInfo * entry,
void * data)
Expand Down
5 changes: 5 additions & 0 deletions parsers/cxx/cxx_tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,9 @@ void cxxTagInitForLanguage(langType eLangType);
// just for preventing emitting reference tags associated with the token(s).
void cxxTagUseTokensInRangeAsPartOfDefTags(int iCorkIndex, CXXToken * pFrom, CXXToken * pTo);
void cxxTagUseTokenAsPartOfDefTag(int iCorkIndex, CXXToken * pToken);

// Reset the kind and role of the tag specified with iCorkIndex.
// The scope of the tag is also updated with iScopeCorkIndex.
void cxxTagResetRefTag(int iCorkIndex, int iScopeCorkIndex,
int iKindIndex, int iRoleIndex);
#endif //!_cxxTag_h_

0 comments on commit 0e49c79

Please sign in to comment.