Page MenuHomePhabricator

MismatchingNewDeleteDetector uses incorrect field, and finds no initializer

Authored by ismailp on May 20 2015, 3:46 PM.



In MismatchingNewDeleteDetector::analyzeInClassInitializer, if
Field's initializer expression is null, lookup the field in
implicit instantiation, and use found field's the initializer.

Diff Detail


Event Timeline

ismailp updated this revision to Diff 26189.May 20 2015, 3:46 PM
ismailp retitled this revision from to MismatchingNewDeleteDetector uses incorrect field, and finds no initializer.
ismailp updated this object.
ismailp edited the test plan for this revision. (Show Details)
ismailp added reviewers: rsmith, rtrieu.
ismailp added a subscriber: Unknown Object (MLST).
rsmith added inline comments.May 20 2015, 3:58 PM
2494 ↗(On Diff #26189)

You'll still crash if this check fails. You could assert this condition instead, but InitExpr could still be null even then, in principle (if we're somehow getting called while still parsing the definition of the class).

The in-class initializer is not relevant if no constructor actually uses it. Instead of this change, you could just return EndOfTU ? NoMismatch : AnalyzeLater if InitExpr is null.

ismailp updated this revision to Diff 26271.May 21 2015, 1:06 PM

Return from analyzeInClassInitializer, if in-class initializer is null.

Ping! It seems like this patch was forgotten. This fixes PR24730, which is reported recently.

ismailp marked an inline comment as done.


rsmith accepted this revision.Oct 6 2015, 5:04 PM
rsmith edited edge metadata.


This revision is now accepted and ready to land.Oct 6 2015, 5:04 PM
This revision was automatically updated to reflect the committed changes.