Fixes PR25668.
Details
Diff Detail
Event Timeline
This doesn't look right to me. Aborting tree transform on a bad source location seems just wrong. Where is the invalid source location coming from? Also the backtrace seems related to typo correction, maybe the bug is there?
I have post the whole stack trace in PR25668.
The invalid source location comes from TypoExpr which is returned by ArraySubscriptExpr->getLHS(), this is also why there is a FIXME in code line. After reading the code more throughly, I find that the invalid source location is expected when constructing a TypoExpr.
I updated the fixing patch now. We probably don't call RequireCompleteType with an invalid source location, which is the same as trunk@84793.
It seems to me that the bug is that we're producing an invalid source location, not how we handle that downstream. Typo correction should be able to preserve the source location of whatever expression it was correcting.
lib/Sema/SemaExpr.cpp | ||
---|---|---|
14047–14048 ↗ | (On Diff #49939) | General rule: for a function that returns true to say "an error occurred", it is not acceptable to return true without either (a) producing an error or (b) observing some state that proves someone else emitted an error (such as a decl that has been set as invalid). |