Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
ac517cb9
Commit
ac517cb9
authored
Dec 08, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Emit a rudimentary symbol table at the end of the emitted C-code
parent
7fb87518
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
0 deletions
+39
-0
vcc_compile.c
lib/libvcc/vcc_compile.c
+2
-0
vcc_compile.h
lib/libvcc/vcc_compile.h
+2
-0
vcc_symb.c
lib/libvcc/vcc_symb.c
+1
-0
vcc_xref.c
lib/libvcc/vcc_xref.c
+34
-0
No files found.
lib/libvcc/vcc_compile.c
View file @
ac517cb9
...
...
@@ -669,6 +669,8 @@ vcc_CompileSource(struct vcc *tl, struct source *sp)
EmitStruct
(
tl
);
VCC_XrefTable
(
tl
);
/* Combine it all */
vsb
=
VSB_new_auto
();
...
...
lib/libvcc/vcc_compile.h
View file @
ac517cb9
...
...
@@ -121,6 +121,7 @@ struct symbol {
VTAILQ_ENTRY
(
symbol
)
list
;
VTAILQ_HEAD
(,
symbol
)
children
;
struct
symbol
*
parent
;
const
char
*
vmod
;
char
*
name
;
...
...
@@ -346,6 +347,7 @@ void vcc_ParseNew(struct vcc *tl);
int
vcc_AddDef
(
struct
vcc
*
tl
,
const
struct
token
*
t
,
enum
symkind
type
);
void
vcc_AddRef
(
struct
vcc
*
tl
,
const
struct
token
*
t
,
enum
symkind
type
);
int
vcc_CheckReferences
(
struct
vcc
*
tl
);
void
VCC_XrefTable
(
struct
vcc
*
);
void
vcc_AddCall
(
struct
vcc
*
tl
,
struct
token
*
t
);
struct
proc
*
vcc_AddProc
(
struct
vcc
*
tl
,
struct
token
*
t
);
...
...
lib/libvcc/vcc_symb.c
View file @
ac517cb9
...
...
@@ -144,6 +144,7 @@ VCC_Symbol(struct vcc *tl, struct symbol *parent,
return
(
sym
);
if
(
sym
==
NULL
)
{
sym
=
vcc_new_symbol
(
tl
,
b
,
q
);
sym
->
parent
=
parent
;
if
(
sym2
!=
NULL
)
VTAILQ_INSERT_BEFORE
(
sym2
,
sym
,
list
);
else
...
...
lib/libvcc/vcc_xref.c
View file @
ac517cb9
...
...
@@ -392,3 +392,37 @@ vcc_CheckUses(struct vcc *tl)
VCC_WalkSymbols
(
tl
,
vcc_checkuses
,
SYM_SUB
);
return
(
tl
->
err
);
}
/*---------------------------------------------------------------------*/
static
void
vcc_pnam
(
struct
vcc
*
tl
,
const
struct
symbol
*
sym
)
{
if
(
sym
->
parent
!=
tl
->
symbols
)
{
vcc_pnam
(
tl
,
sym
->
parent
);
Fc
(
tl
,
0
,
"."
);
}
Fc
(
tl
,
0
,
"%s"
,
sym
->
name
);
}
static
void
__match_proto__
(
symwalk_f
)
vcc_xreftable
(
struct
vcc
*
tl
,
const
struct
symbol
*
sym
)
{
Fc
(
tl
,
0
,
" * %-7s "
,
VCC_SymKind
(
tl
,
sym
));
Fc
(
tl
,
0
,
" %-9s "
,
sym
->
fmt
!=
NULL
?
sym
->
fmt
->
name
:
""
);
vcc_pnam
(
tl
,
sym
);
if
(
sym
->
wildcard
!=
NULL
)
Fc
(
tl
,
0
,
"*"
);
Fc
(
tl
,
0
,
"
\n
"
);
}
void
VCC_XrefTable
(
struct
vcc
*
tl
)
{
Fc
(
tl
,
0
,
"
\n
/*
\n
* Symbol Table
\n
*
\n
"
);
VCC_WalkSymbols
(
tl
,
vcc_xreftable
,
SYM_NONE
);
Fc
(
tl
,
0
,
"*/
\n\n
"
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment