Skip to content

Commit 0e49c79

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

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

parsers/cxx/cxx_tag.c

+18
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,24 @@ void cxxTagUseTokensInRangeAsPartOfDefTags(int iCorkIndex, CXXToken * pFrom, CXX
277277
}
278278
}
279279

280+
void cxxTagResetRefTag(int iCorkIndex, int iScopeCorkIndex,
281+
int iKindIndex, int iRoleIndex)
282+
{
283+
tagEntryInfo *pEntry = getEntryInCorkQueue(iCorkIndex);
284+
if(pEntry == NULL)
285+
return;
286+
if (pEntry->placeholder)
287+
return;
288+
289+
clearRoles(pEntry);
290+
if(pEntry->extensionFields.scopeIndex != CORK_NIL)
291+
unregisterEntry(iCorkIndex);
292+
pEntry->extensionFields.scopeIndex = iScopeCorkIndex;
293+
pEntry->kindIndex = iKindIndex;
294+
assignRole(pEntry, iRoleIndex);
295+
registerEntry(iCorkIndex);
296+
}
297+
280298
static bool countSameKindEntry(int corkIndex,
281299
tagEntryInfo * entry,
282300
void * data)

parsers/cxx/cxx_tag.h

+5
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,9 @@ void cxxTagInitForLanguage(langType eLangType);
213213
// just for preventing emitting reference tags associated with the token(s).
214214
void cxxTagUseTokensInRangeAsPartOfDefTags(int iCorkIndex, CXXToken * pFrom, CXXToken * pTo);
215215
void cxxTagUseTokenAsPartOfDefTag(int iCorkIndex, CXXToken * pToken);
216+
217+
// Reset the kind and role of the tag specified with iCorkIndex.
218+
// The scope of the tag is also updated with iScopeCorkIndex.
219+
void cxxTagResetRefTag(int iCorkIndex, int iScopeCorkIndex,
220+
int iKindIndex, int iRoleIndex);
216221
#endif //!_cxxTag_h_

0 commit comments

Comments
 (0)