Skip to content

Commit 4dfa0c0

Browse files
committed
LdScript: add aliased role to symbol kind of LdScript language
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent d48d1d5 commit 4dfa0c0

File tree

10 files changed

+48
-3
lines changed

10 files changed

+48
-3
lines changed

Tmain/list-roles.d/stdout-expected.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Kconfig k/kconfig source on kconfig file loaded
7474
LdScript i/inputSection destination on specified as the destination of code and data
7575
LdScript i/inputSection discarded on discarded when linking
7676
LdScript i/inputSection mapped on mapped to output section
77+
LdScript s/symbol aliased on aliased with __attribute__((alias(...))) in C/C++ code
7778
LdScript s/symbol entrypoint on entry points
7879
Lua Y/unknown referenced off referenced somehow
7980
M4 I/macrofile included on included macro
@@ -206,6 +207,7 @@ Kconfig k/kconfig source on kconfig file loaded
206207
LdScript i/inputSection destination on specified as the destination of code and data
207208
LdScript i/inputSection discarded on discarded when linking
208209
LdScript i/inputSection mapped on mapped to output section
210+
LdScript s/symbol aliased on aliased with __attribute__((alias(...))) in C/C++ code
209211
LdScript s/symbol entrypoint on entry points
210212
Lua Y/unknown referenced off referenced somehow
211213
M4 I/macrofile included on included macro
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
--sort=no
22
--fields-C=+{alias}
3+
--extras=+r
4+
--fields=+{roles}{language}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
x input.c /^int x __attribute__((alias("y")));$/;" v typeref:typename:int alias:y
1+
y input.c /^int x __attribute__((alias("y")));$/;" s language:LdScript roles:aliased
2+
x input.c /^int x __attribute__((alias("y")));$/;" v language:C typeref:typename:int roles:def alias:y

docs/man/ctags-lang-asm.7.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,6 @@ Change since "0.0"
183183

184184
SEE ALSO
185185
--------
186-
:ref:`ctags(1) <ctags(1)>`, Info entries for GNU assembler
186+
:ref:`ctags(1) <ctags(1)>`,
187+
:ref:`ctags-lang-asm(7) <ctags-lang-asm(7)>`,
188+
Info entries for GNU assembler

docs/man/ctags-lang-ldscript.7.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ Change since "0.0"
2929

3030
* New role ``destination`` for ``inputSection`` kind
3131

32+
* New role ``aliased`` for ``symbol`` kind
33+
3234
SEE ALSO
3335
--------
3436
:ref:`ctags(1) <ctags(1)>`,
37+
:ref:`ctags-lang-asm(7) <ctags-lang-asm(7)>`,
3538
:ref:`ctags-lang-c(7) <ctags-lang-c(7)>`,
3639
:ref:`ctags-lang-c++(7) <ctags-lang-c++(7)>`,
3740
:ref:`ctags-lang-cuda(7) <ctags-lang-cuda(7)>`

docs/news/HEAD.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Changes about parser specific kinds, roles, fields, and extras
6464
+ New role `foreigndecl` for `function` kind
6565
+ New role `foreigndecl` for `struct` kind
6666

67+
6768
+ New filed `section`
6869

6970
+ New field `alias`
@@ -96,6 +97,8 @@ Changes about parser specific kinds, roles, fields, and extras
9697

9798
+ New role `destination` for `inputSection` kind
9899

100+
+ New role `aliased` for `symbol` kind
101+
99102
* Markdown
100103

101104
+ New kind `hashtag`

man/ctags-lang-asm.7.rst.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,6 @@ Change since "0.0"
183183

184184
SEE ALSO
185185
--------
186-
ctags(1), Info entries for GNU assembler
186+
ctags(1),
187+
ctags-lang-asm(7),
188+
Info entries for GNU assembler

man/ctags-lang-ldscript.7.rst.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ Change since "0.0"
2929

3030
* New role ``destination`` for ``inputSection`` kind
3131

32+
* New role ``aliased`` for ``symbol`` kind
33+
3234
SEE ALSO
3335
--------
3436
ctags(1),
37+
ctags-lang-asm(7),
3538
ctags-lang-c(7),
3639
ctags-lang-c++(7),
3740
ctags-lang-cuda(7)

parsers/cxx/cxx_side_chain.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,31 @@ static void cxxScanAttrExtractAlias(const CXXToken * pToken)
9494
vStringChop(pArgToken->pszWord);
9595
cxxTagSetField(CXXTagFieldAlias, vStringValue(pArgToken->pszWord)+1, true);
9696

97+
tagEntryInfo e;
98+
static langType lang = LANG_AUTO;
99+
100+
if(lang == LANG_AUTO)
101+
lang = getNamedLanguage("LdScript", 0);
102+
if(lang == LANG_IGNORE)
103+
goto out;
104+
105+
static kindDefinition * kdef = NULL;
106+
if(kdef == NULL)
107+
kdef = getLanguageKindForName (lang, "symbol");
108+
if(kdef == NULL)
109+
goto out;
110+
111+
static roleDefinition *rdef = NULL;
112+
if(rdef == NULL)
113+
rdef = getLanguageRoleForName (lang, kdef->id, "aliased");
114+
if(rdef == NULL)
115+
goto out;
116+
117+
initForeignRefTagEntry(&e, vStringValue(pArgToken->pszWord)+1,
118+
lang, kdef->id, rdef->id);
119+
makeTagEntry(&e);
120+
121+
out:
97122
vStringPut(pArgToken->pszWord, '"');
98123
}
99124

parsers/ldscript.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@
2929

3030
typedef enum {
3131
LD_SCRIPT_SYMBOL_ENTRYPOINT,
32+
LD_SCRIPT_SYMBOL_ALIASED,
3233
} ldScriptSymbolRole;
3334

3435
static roleDefinition LdScriptSymbolRoles [] = {
3536
{ true, "entrypoint", "entry points" },
37+
{ true, "aliased", "aliased with __attribute__((alias(...))) in C/C++ code" },
3638
};
3739

3840
typedef enum {

0 commit comments

Comments
 (0)