diff options
Diffstat (limited to 'go/pointer/api.go')
-rw-r--r-- | go/pointer/api.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/go/pointer/api.go b/go/pointer/api.go index 2a13a6781..8c9a8c775 100644 --- a/go/pointer/api.go +++ b/go/pointer/api.go @@ -28,7 +28,11 @@ type Config struct { // dependencies of any main package may still affect the // analysis result, because they contribute runtime types and // thus methods. + // // TODO(adonovan): investigate whether this is desirable. + // + // Calls to generic functions will be unsound unless packages + // are built using the ssa.InstantiateGenerics builder mode. Mains []*ssa.Package // Reflection determines whether to handle reflection @@ -93,7 +97,7 @@ func (c *Config) AddQuery(v ssa.Value) { c.Queries[v] = struct{}{} } -// AddQuery adds v to Config.IndirectQueries. +// AddIndirectQuery adds v to Config.IndirectQueries. // Precondition: CanPoint(v.Type().Underlying().(*types.Pointer).Elem()). func (c *Config) AddIndirectQuery(v ssa.Value) { if c.IndirectQueries == nil { @@ -128,9 +132,10 @@ func (c *Config) AddIndirectQuery(v ssa.Value) { // before analysis has finished has undefined behavior. // // Example: -// // given v, which represents a function call to 'fn() (int, []*T)', and -// // 'type T struct { F *int }', the following query will access the field F. -// c.AddExtendedQuery(v, "x[1][0].F") +// +// // given v, which represents a function call to 'fn() (int, []*T)', and +// // 'type T struct { F *int }', the following query will access the field F. +// c.AddExtendedQuery(v, "x[1][0].F") func (c *Config) AddExtendedQuery(v ssa.Value, query string) (*Pointer, error) { ops, _, err := parseExtendedQuery(v.Type(), query) if err != nil { @@ -160,7 +165,6 @@ type Warning struct { // A Result contains the results of a pointer analysis. // // See Config for how to request the various Result components. -// type Result struct { CallGraph *callgraph.Graph // discovered call graph Queries map[ssa.Value]Pointer // pts(v) for each v in Config.Queries. @@ -172,7 +176,6 @@ type Result struct { // // A Pointer doesn't have a unique type because pointers of distinct // types may alias the same object. -// type Pointer struct { a *analysis n nodeid @@ -223,7 +226,6 @@ func (s PointsToSet) Labels() []*Label { // map value is the PointsToSet for pointers of that type. // // The result is empty unless CanHaveDynamicTypes(T). -// func (s PointsToSet) DynamicTypes() *typeutil.Map { var tmap typeutil.Map tmap.SetHasher(s.a.hasher) |