Skip to content

Commit

Permalink
C++: record "export" in the property field if the keyword is put at a…
Browse files Browse the repository at this point in the history
… namespace alias

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed May 23, 2024
1 parent fcffa4b commit 8cdecb1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Units/parser-cxx.r/export-namespace-alias.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--sort=no
--fields-C++=+{properties}
--fields=+K
--kinds-C++=+{alias}
4 changes: 4 additions & 0 deletions Units/parser-cxx.r/export-namespace-alias.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mylib input.cpp /^export module mylib;$/;" module properties:export
X input.cpp /^export namespace X {$/;" namespace file: properties:export
i input.cpp /^ int i;$/;" variable namespace:X typeref:typename:int
Z input.cpp /^export namespace Z = X;$/;" alias file: properties:export name:X
7 changes: 7 additions & 0 deletions Units/parser-cxx.r/export-namespace-alias.d/input.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export module mylib;

export namespace X {
int i;
}

export namespace Z = X;
1 change: 1 addition & 0 deletions Units/parser-cxx.r/export-namespace-alias.d/validator
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cxx20+module
5 changes: 5 additions & 0 deletions parsers/cxx/cxx_parser_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ bool cxxParserParseNamespace(void)
// This is highly questionable but well.. it's how old ctags did, so we do.
tag->isFileScope = !isInputHeaderFile();

vString * pszProperties = NULL;
if(uProperties)
pszProperties = cxxTagSetProperties(uProperties);

CXXToken * pAliasedName = cxxTokenChainExtractRange(
pFirstIdentifier,
pLastIdentifier,
Expand All @@ -152,6 +156,7 @@ bool cxxParserParseNamespace(void)

cxxTagCommit(NULL);

vStringDelete (pszProperties); /* NULL is acceptable. */
cxxTokenDestroy(pAliasedName);
}

Expand Down

0 comments on commit 8cdecb1

Please sign in to comment.