Skip to content

Commit 4e55739

Browse files
committed
Cxx: add a helper function for resetting kind, role, and scope
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 3c987b0 commit 4e55739

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

parsers/cxx/cxx_tag.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,24 @@ void cxxTagUseTokensInRangeAsPartOfDefTags(int iCorkIndex, CXXToken * pFrom, CXX
292292
}
293293
}
294294

295+
void cxxTagResetRefTag(int iCorkIndex, int iScopeCorkIndex,
296+
int iKindIndex, int iRoleIndex)
297+
{
298+
tagEntryInfo *pEntry = getEntryInCorkQueue(iCorkIndex);
299+
if(pEntry == NULL)
300+
return;
301+
if (pEntry->placeholder)
302+
return;
303+
304+
clearRoles(pEntry);
305+
if(pEntry->extensionFields.scopeIndex != CORK_NIL)
306+
unregisterEntry(iCorkIndex);
307+
pEntry->extensionFields.scopeIndex = iScopeCorkIndex;
308+
pEntry->kindIndex = iKindIndex;
309+
assignRole(pEntry, iRoleIndex);
310+
registerEntry(iCorkIndex);
311+
}
312+
295313
static bool countSameKindEntry(int corkIndex,
296314
tagEntryInfo * entry,
297315
void * data)

parsers/cxx/cxx_tag.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,9 @@ void cxxTagInitForLanguage(langType eLangType);
216216
// just for preventing emitting reference tags associated with the token(s).
217217
void cxxTagUseTokensInRangeAsPartOfDefTags(int iCorkIndex, CXXToken * pFrom, CXXToken * pTo);
218218
void cxxTagUseTokenAsPartOfDefTag(int iCorkIndex, CXXToken * pToken);
219+
220+
// Reset the kind and role of the tag specified with iCorkIndex.
221+
// The scope of the tag is also updated with iScopeCorkIndex.
222+
void cxxTagResetRefTag(int iCorkIndex, int iScopeCorkIndex,
223+
int iKindIndex, int iRoleIndex);
219224
#endif //!_cxxTag_h_

0 commit comments

Comments
 (0)