Mailing List Archive

[master] 5bf609bdb vcc: Cross reference VMOD symbols
commit 5bf609bdb3e1dd8bfb51d56acd45523cab2a6d7f
Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
Date: Tue Jan 19 06:49:41 2021 +0100

vcc: Cross reference VMOD symbols

With a default read mask based on the type of symbol. Starting with a
default comprehensive mask should then help implement the $Restrict
stanza from VIP4, simply by AND-ing the masks.

diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 65d62b24f..e5373b5b4 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -455,14 +455,14 @@ vcc_do_arg(struct vcc *tl, struct func_arg *fa)

static void
vcc_func(struct vcc *tl, struct expr **e, const void *priv,
- const char *extra, const struct symbol *sym)
+ const char *extra, struct symbol *sym)
{
vcc_type_t rfmt;
const char *cfunc;
struct expr *e1;
struct func_arg *fa, *fa2;
VTAILQ_HEAD(,func_arg) head;
- struct token *t1;
+ struct token *tf, *t1;
const struct vjsn_val *vv, *vvp;
const char *sa, *extra_sep;
char ssa[64];
@@ -492,6 +492,7 @@ vcc_func(struct vcc *tl, struct expr **e, const void *priv,
AN((*e)->instance);
extra = (*e)->instance->rname;
}
+ tf = VTAILQ_PREV(tl->t, tokenhead, list);
SkipToken(tl, '(');
if (extra == NULL) {
extra = "";
@@ -631,6 +632,7 @@ vcc_func(struct vcc *tl, struct expr **e, const void *priv,
*e = vcc_expr_edit(tl, e1->fmt, "\v1\v-\n)", e1, NULL);
}
SkipToken(tl, ')');
+ vcc_AddUses(tl, tf, NULL, sym, XREF_READ);
}


diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c
index 04e4375d2..4ecd217c6 100644
--- a/lib/libvcc/vcc_vmod.c
+++ b/lib/libvcc/vcc_vmod.c
@@ -97,6 +97,7 @@ func_sym(struct vcc *tl, vcc_kind_t kind, const struct symbol *psym,
if (kind == SYM_OBJECT) {
sym->eval_priv = v;
sym->vmod_name = psym->vmod_name;
+ sym->r_methods = VCL_MET_INIT;
vcc_VmodObject(tl, sym);
vcc_VmodSymbols(tl, sym);
return;
@@ -118,6 +119,7 @@ func_sym(struct vcc *tl, vcc_kind_t kind, const struct symbol *psym,
assert(v->type == VJSN_STRING);
sym->type = VCC_Type(v->value);
AN(sym->type);
+ sym->r_methods = VCL_MET_TASK_C|VCL_MET_TASK_B|VCL_MET_TASK_H;
}

static void
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit