Skip to content

Commit 5fae75d

Browse files
authored
Merge pull request #4006 from masatake/cxx--fix-export-prop-for-using
C++: record "export" in the property field if the keyword is put at a "using" declaration
2 parents 8904e85 + 4674749 commit 5fae75d

File tree

5 files changed

+32
-0
lines changed

5 files changed

+32
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
--sort=no
2+
--fields=+K
3+
--kinds-C++=+MtNp
4+
--fields-C++=+{properties}
5+
--extras=+r
6+
--fields=+r
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Delta input.cpp /^export module Delta;$/;" module roles:def properties:export
2+
Param input.cpp /^export using Param = int;$/;" typedef typeref:typename:int file: roles:def properties:export
3+
Param input.cpp /^export using ::Param;$/;" name file: roles:def properties:export
4+
Param input.cpp /^export using ::Param; \/\/ We can declare an object more than twice.$/;" name file: roles:def properties:export
5+
fn input.cpp /^export void fn();$/;" prototype typeref:typename:void file: roles:def properties:export
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Derived from https://github.com/universal-ctags/ctags/issues/4003 submitted by @adrianconstantin-leroy.
2+
export module Delta;
3+
4+
export using Param = int;
5+
export using ::Param;
6+
export using ::Param; // We can declare an object more than twice.
7+
export void fn();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cxx20+module

parsers/cxx/cxx_parser_using.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ bool cxxParserParseUsingClause(void)
2424
{
2525
CXX_DEBUG_ENTER();
2626

27+
unsigned int uInitialKeywordState = g_cxx.uKeywordState;
28+
2729
// using-directives for namespaces and using-declarations
2830
// for namespace members
2931
// using-declarations for class members
@@ -170,7 +172,18 @@ bool cxxParserParseUsingClause(void)
170172
{
171173
tag->isFileScope = (cxxScopeGetType() == CXXScopeTypeNamespace) &&
172174
(!isInputHeaderFile());
175+
176+
unsigned int uProperties = 0;
177+
if(uInitialKeywordState & CXXParserKeywordStateSeenExport)
178+
uProperties |= CXXTagPropertyExport;
179+
vString * pszProperties = NULL;
180+
181+
if(uProperties)
182+
pszProperties = cxxTagSetProperties(uProperties);
183+
173184
cxxTagCommit(NULL);
185+
186+
vStringDelete (pszProperties);
174187
}
175188
}
176189
}

0 commit comments

Comments
 (0)