Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOperation API for BoundPointerElementAccesss #19960

Open
mavasani opened this issue Jun 1, 2017 · 5 comments
Open

IOperation API for BoundPointerElementAccesss #19960

mavasani opened this issue Jun 1, 2017 · 5 comments
Labels
Area-Analyzers Bug Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature - IOperation IOperation _Product-level triaged
Milestone

Comments

@mavasani
Copy link
Contributor

mavasani commented Jun 1, 2017

API Proposal

    public interface IPointerElementReferenceExpression : IOperation
    {
        /// <summary>
        /// Pointer to be indexed.
        /// </summary>
        IOperation Expression { get; }
        /// <summary>
        /// Index for the element to reference.
        /// </summary>
        IOperation Index { get; }
        /// <summary>
        /// Boolean indicating if this is a checked expression or not.
        /// </summary>
        bool Checked { get; }
    }
@mavasani mavasani added Area-Analyzers Bug Concept-API This issue involves adding, removing, clarification, or modification of an API. Discussion Feature - IOperation IOperation labels Jun 1, 2017
@mavasani mavasani added this to the 15.later milestone Jun 1, 2017
@mavasani
Copy link
Contributor Author

mavasani commented Jun 8, 2017

@jinujoseph We can discuss this one today - I added an API proposal.

@CyrusNajmabadi
Copy link
Member

Do we need this if we just hav a general IIndexingOperation?

@CyrusNajmabadi
Copy link
Member

The only thing i can see is that this has IsChecked. (though how do you have an unchecked/checked pointer element access)?

@jinujoseph
Copy link
Contributor

Design Team Decision

We should use just same node to represent Array and pointer, call it "IElementIndexingExpression"
We should expose Kind to differentiate both.
Don't expose the Ischecked for now.

@jinujoseph jinujoseph modified the milestones: 15.5, 15.later Jul 3, 2017
@jinujoseph jinujoseph removed this from the 15.5 milestone Jul 13, 2017
@tmat tmat added this to the 15.later milestone Sep 6, 2017
@jinujoseph jinujoseph modified the milestones: 15.later, Unknown Sep 27, 2017
@jinujoseph jinujoseph modified the milestones: Unknown, 16.0 Jun 23, 2018
@jinujoseph jinujoseph removed this from the 16.0 milestone Jan 16, 2019
@jinujoseph jinujoseph added this to the 16.1 milestone Jan 16, 2019
@jinujoseph jinujoseph modified the milestones: 16.1, Backlog Apr 24, 2019
@dgrunwald
Copy link

What's the status here?
IArrayElementReferenceOperation is public, IPointerIndirectionReferenceOperation is internal.

Also I seem to be getting a NoneOperation for pointer dereferences. These don't even call DefaultVisit in my operation visitor. This results in some rather ugly workarounds: https://github.com/icsharpcode/NullabilityInference/blob/1c436f70152da527e3b30cbfbb81db00afd1a317/NullabilityInference/EdgeBuildingOperationVisitor.cs#L64-L77

I think it would make sense to make IPointerIndirectionReferenceOperation public as-is (without Index or Checked properties), and represent unsafe pointer indexing ptr[i] using two nodes, same as *(ptr + i).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Analyzers Bug Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature - IOperation IOperation _Product-level triaged
Projects
None yet
Development

No branches or pull requests

5 participants