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

C#/Java/Go: Neutrals are split into separate classes. #17007

Merged
merged 4 commits into from
Aug 12, 2024

Conversation

michaelnebel
Copy link
Contributor

@michaelnebel michaelnebel commented Jul 17, 2024

The existing implementation doesn't handle kind and provenance in conjunction with each other as they get mixed in the NeutralCallable class (we basically get the product of the kinds and provenances - see the example below).
The neutral classes are now created based on parameterised modules instead.

If we quick eval the myTest predicate in the following example, we get the tuples (A,A1) and (A,A2).

bindingset[this]
abstract class Base extends string {
  abstract string getValue();
}

class A1 extends Base {
  A1() { this = "A" }

  override string getValue() { result = "A1" }
}

class A2 extends Base {
  A2() { this = "A" }

  override string getValue() { result = "A2" }
}

predicate myTest(A2 a, string value) { a.getValue() = value }``

@michaelnebel michaelnebel changed the title C#/Java: Neutrals are split into seperate classes. C#/Java: Neutrals are split into separate classes. Jul 18, 2024
@michaelnebel
Copy link
Contributor Author

DCA except for swift looks good.
Will re-run DCA for swift.

@michaelnebel michaelnebel changed the title C#/Java: Neutrals are split into separate classes. C#/Java/Go: Neutrals are split into separate classes. Jul 19, 2024
@michaelnebel
Copy link
Contributor Author

After discussing this in the swift channel on slack - it appears that it is not uncommon that DCA shows a slowdown as the execution time is generally low for the swift projects; Accepting the DCA executions for swift as well.

@michaelnebel michaelnebel added the no-change-note-required This PR does not need a change note label Jul 19, 2024
@michaelnebel michaelnebel marked this pull request as ready for review July 19, 2024 09:22
@michaelnebel michaelnebel requested review from a team as code owners July 19, 2024 09:22
Copy link
Contributor

@aschackmull aschackmull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable.

@@ -20,6 +20,10 @@ public class NewSinks
// neutral=Sinks;NewSinks;Sink2;(System.Object);summary;df-generated
public static void Sink2(object o) => throw null;

// Defined as sink neutral in the file next to the neutral summary test.
// neutral=Sinks;NewSinks;NoSink;(System.Object);summary;df-generated
public static void NoSink(object o) => throw null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the bug is fixed, isn't this a confusing name? (Same for the java test.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method is defined as sink (manual) and summary (df-generated) neutral in the extensible file.
That is, we expect that the "neutral" test (which only reports summary neutrals) would generate a neutral (df-generated) summary for this method.
The name "NoSink" is because it is explicitly stated in the extensible file that this method is sink neutral (it is not a sink).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Thanks for explaining.

@michaelnebel michaelnebel merged commit 4a5c9f0 into github:main Aug 12, 2024
53 checks passed
@michaelnebel michaelnebel deleted the shared/neutralimplementation branch August 12, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants