From 288e0ec565bd0b094868a4e4282613a470c40246 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Tue, 1 Oct 2024 14:39:32 +0100 Subject: [PATCH] component_tags -> struct_tags --- .../go.dbscheme | 0 .../old.dbscheme | 2 +- .../upgrade.properties | 2 +- go/extractor/dbscheme/tables.go | 4 ++-- go/extractor/extractor.go | 2 +- go/ql/lib/go.dbscheme | 2 +- go/ql/lib/go.dbscheme.stats | 2 +- go/ql/lib/semmle/go/Types.qll | 8 ++++---- .../a58b81b1b4c4cccc8ca11731c1db86622f33af57/go.dbscheme | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) rename go/downgrades/{76243dd9f77adbf125835fb83a510465b2f29a24 => 4bd57e093275e5e892dfb16b55ed4bd76ea662be}/go.dbscheme (100%) rename go/downgrades/{76243dd9f77adbf125835fb83a510465b2f29a24 => 4bd57e093275e5e892dfb16b55ed4bd76ea662be}/old.dbscheme (99%) rename go/downgrades/{76243dd9f77adbf125835fb83a510465b2f29a24 => 4bd57e093275e5e892dfb16b55ed4bd76ea662be}/upgrade.properties (82%) diff --git a/go/downgrades/76243dd9f77adbf125835fb83a510465b2f29a24/go.dbscheme b/go/downgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/go.dbscheme similarity index 100% rename from go/downgrades/76243dd9f77adbf125835fb83a510465b2f29a24/go.dbscheme rename to go/downgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/go.dbscheme diff --git a/go/downgrades/76243dd9f77adbf125835fb83a510465b2f29a24/old.dbscheme b/go/downgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/old.dbscheme similarity index 99% rename from go/downgrades/76243dd9f77adbf125835fb83a510465b2f29a24/old.dbscheme rename to go/downgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/old.dbscheme index 76243dd9f77..4bd57e09327 100644 --- a/go/downgrades/76243dd9f77adbf125835fb83a510465b2f29a24/old.dbscheme +++ b/go/downgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/old.dbscheme @@ -208,7 +208,7 @@ underlying_type(unique int named: @namedtype ref, int tp: @type ref); component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref); #keyset[parent, index] -component_tags(int parent: @structtype ref, int index: int ref, string tag: string ref); +struct_tags(int parent: @structtype ref, int index: int ref, string tag: string ref); #keyset[interface, index] interface_private_method_ids(int interface: @interfacetype ref, int index: int ref, string id: string ref); diff --git a/go/downgrades/76243dd9f77adbf125835fb83a510465b2f29a24/upgrade.properties b/go/downgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/upgrade.properties similarity index 82% rename from go/downgrades/76243dd9f77adbf125835fb83a510465b2f29a24/upgrade.properties rename to go/downgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/upgrade.properties index 976c2c81bfa..0cda1e3644f 100644 --- a/go/downgrades/76243dd9f77adbf125835fb83a510465b2f29a24/upgrade.properties +++ b/go/downgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/upgrade.properties @@ -1,5 +1,5 @@ description: Remove component-tags and interface-method-id tables compatibility: full -component_tags.rel: delete +struct_tags.rel: delete interface_private_method_ids.rel: delete diff --git a/go/extractor/dbscheme/tables.go b/go/extractor/dbscheme/tables.go index ec74c7a2c0d..aa44c624842 100644 --- a/go/extractor/dbscheme/tables.go +++ b/go/extractor/dbscheme/tables.go @@ -1150,8 +1150,8 @@ var ComponentTypesTable = NewTable("component_types", EntityColumn(TypeType, "tp"), ).KeySet("parent", "index") -// ComponentTagsTable is the table associating struct types with their component types' tags -var ComponentTagsTable = NewTable("component_tags", +// StructTagsTable is the table associating struct types with their component types' tags +var StructTagsTable = NewTable("struct_tags", EntityColumn(StructType, "parent"), IntColumn("index"), StringColumn("tag"), diff --git a/go/extractor/extractor.go b/go/extractor/extractor.go index 8a399eb2b90..c157f7c8f67 100644 --- a/go/extractor/extractor.go +++ b/go/extractor/extractor.go @@ -1625,7 +1625,7 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label { } extractComponentType(tw, lbl, i, name, field.Type()) if tp.Tag(i) != "" { - dbscheme.ComponentTagsTable.Emit(tw, lbl, i, tp.Tag(i)) + dbscheme.StructTagsTable.Emit(tw, lbl, i, tp.Tag(i)) } } case *types.Pointer: diff --git a/go/ql/lib/go.dbscheme b/go/ql/lib/go.dbscheme index 76243dd9f77..4bd57e09327 100644 --- a/go/ql/lib/go.dbscheme +++ b/go/ql/lib/go.dbscheme @@ -208,7 +208,7 @@ underlying_type(unique int named: @namedtype ref, int tp: @type ref); component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref); #keyset[parent, index] -component_tags(int parent: @structtype ref, int index: int ref, string tag: string ref); +struct_tags(int parent: @structtype ref, int index: int ref, string tag: string ref); #keyset[interface, index] interface_private_method_ids(int interface: @interfacetype ref, int index: int ref, string id: string ref); diff --git a/go/ql/lib/go.dbscheme.stats b/go/ql/lib/go.dbscheme.stats index 50565d963aa..a602a143ee0 100644 --- a/go/ql/lib/go.dbscheme.stats +++ b/go/ql/lib/go.dbscheme.stats @@ -13979,7 +13979,7 @@ - component_tags + struct_tags 41038845 diff --git a/go/ql/lib/semmle/go/Types.qll b/go/ql/lib/semmle/go/Types.qll index 8a9bcf1f91c..651cda82eb6 100644 --- a/go/ql/lib/semmle/go/Types.qll +++ b/go/ql/lib/semmle/go/Types.qll @@ -467,9 +467,9 @@ class StructType extends @structtype, CompositeType { predicate hasOwnFieldWithTag(int i, string name, Type tp, boolean isEmbedded, string tag) { this.hasOwnField(i, name, tp, isEmbedded) and ( - component_tags(this, i, tag) + struct_tags(this, i, tag) or - not component_tags(this, i, _) and tag = "" + not struct_tags(this, i, _) and tag = "" ) } @@ -594,9 +594,9 @@ class StructType extends @structtype, CompositeType { concat(int i, string name, Type tp, string tagToPrint | component_types(this, i, name, tp) and ( - tagToPrint = " `" + any(string tag | component_tags(this, i, tag)) + "`" + tagToPrint = " `" + any(string tag | struct_tags(this, i, tag)) + "`" or - tagToPrint = "" and not component_tags(this, i, _) + tagToPrint = "" and not struct_tags(this, i, _) ) | name + " " + tp.pp() + tagToPrint, "; " order by i diff --git a/go/ql/lib/upgrades/a58b81b1b4c4cccc8ca11731c1db86622f33af57/go.dbscheme b/go/ql/lib/upgrades/a58b81b1b4c4cccc8ca11731c1db86622f33af57/go.dbscheme index 76243dd9f77..4bd57e09327 100644 --- a/go/ql/lib/upgrades/a58b81b1b4c4cccc8ca11731c1db86622f33af57/go.dbscheme +++ b/go/ql/lib/upgrades/a58b81b1b4c4cccc8ca11731c1db86622f33af57/go.dbscheme @@ -208,7 +208,7 @@ underlying_type(unique int named: @namedtype ref, int tp: @type ref); component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref); #keyset[parent, index] -component_tags(int parent: @structtype ref, int index: int ref, string tag: string ref); +struct_tags(int parent: @structtype ref, int index: int ref, string tag: string ref); #keyset[interface, index] interface_private_method_ids(int interface: @interfacetype ref, int index: int ref, string id: string ref);