[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
hongtaihu wrote: #50193 also bisects to this one https://github.com/llvm/llvm-project/pull/143423 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
hongtaihu wrote: Thanks to a (possibly imperfect) bisection, it looks like this PR may also have fixed the following issues: #111749, #114174, #122053, #127911, #138098, #140018. If you have a moment, could you please take a look and confirm whether these are indeed resolved by this pr?@AaronBallman https://github.com/llvm/llvm-project/pull/143423 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
shafik wrote: Looks like this regression is also linked to this change: https://github.com/llvm/llvm-project/issues/174259 https://github.com/llvm/llvm-project/pull/143423 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/143423 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
@@ -2896,29 +2882,8 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,
// a template name, but we happen to have always already looked up the name
// before we get here if it must be a template name.
if (DiagnoseEmptyLookup(S, SS, R, CCC ? *CCC : DefaultValidator, nullptr,
-{}, nullptr, &TE)) {
- if (TE && KeywordReplacement) {
-auto &State = getTypoExprState(TE);
-auto BestTC = State.Consumer->getNextCorrection();
-if (BestTC.isKeyword()) {
- auto *II = BestTC.getCorrectionAsIdentifierInfo();
- if (State.DiagHandler)
-State.DiagHandler(BestTC);
- KeywordReplacement->startToken();
shafik wrote:
It looks like this change might be problematic, you removed
`KeywordReplacement` being set but it is still being passed in via
`UnconsumeToken(Replacement);` and if I squint just enough it looks like the
conditions `Result.isUnset()` won't be true anymore but it is not obvious and
it feels like it would have been better to remove this other code as well.
https://github.com/llvm/llvm-project/pull/143423
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
boomanaiden154 wrote: https://github.com/llvm/llvm-project/blob/b5dbf8210a57b986b9802304745f4c5c108cf37b/libcxx/test/libcxx/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp#L9 Looks like this has occurred before and is just handled by disabling the test on the libc++ side. I've put up #144466 to try and get this fixed so we can finally switch over to the runtimes build. https://github.com/llvm/llvm-project/pull/143423 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
@@ -974,7 +974,7 @@ class Foo final {})cpp";
HI.Name = "abc";
HI.Kind = index::SymbolKind::Variable;
HI.NamespaceScope = "";
- HI.Definition = "int abc = ()";
AaronBallman wrote:
Yeah, making a `RecoveryExpr` in these cases would be helpful (though
potentially nontrivial). There was another case where we dropped a `ReturnStmt`
rather than giving it a `RecoveryExpr` operand, and that caused follow-on
diagnostics that were less than helpful.
https://github.com/llvm/llvm-project/pull/143423
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
@@ -974,7 +974,7 @@ class Foo final {})cpp";
HI.Name = "abc";
HI.Kind = index::SymbolKind::Variable;
HI.NamespaceScope = "";
- HI.Definition = "int abc = ()";
kadircet wrote:
despite typoexprs fragile and complicated nature, i think they were providing
most of their value by preserving more nodes in the AST, that can later on be
used by source tools (especially for more error correction :)).
I don't think we need `TypoExpr`s for most of this, if possible, preserving
these `TypoExpr` nodes through `RecoveryExpr`s would actually help a lot with
preserving current behavior of tools but also shape of the AST for any other
application.
I wouldn't block on this though, and wouldn't be surprised if this isn't
trivial, we don't seem to be preserving typoexprs as recovery-exprs most of the
time and I am not sure why.
https://github.com/llvm/llvm-project/pull/143423
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/143423 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
@@ -1888,10 +1888,11 @@ namespace PR15884 {
}
namespace AfterError {
- constexpr int error() {
+ constexpr int error() { // pre-cxx23-error {{no return statement in
constexpr function}}
AaronBallman wrote:
Hmm okay, I didn't write it in the issue but I was thinking that suppression of
follow-on diagnostics is also about the context of the typo (if typo correction
results in us dropping a statement, we should suppress follow-on diagnostics
about the dropped statement). But you're right, this is orthogonal, it's more
general about error recovery. We previously would not drop the `return`
statement here but would instead give it a `RecoveryExpr` for its operand, that
no longer happens.
I've filed [X](https://github.com/llvm/llvm-project/issues/143688) on the
assumption we're removing delayed typos so this will eventually be true. :-D
https://github.com/llvm/llvm-project/pull/143423
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
@@ -4920,6 +4914,11 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind
DKind,
ModifierFound = true;
} else {
StepFound = parseStepSize(*this, Data, Kind, Tok.getLocation());
+if (!StepFound) {
shafik wrote:
huh, spooky action at a distance
https://github.com/llvm/llvm-project/pull/143423
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
@@ -1888,10 +1888,11 @@ namespace PR15884 {
}
namespace AfterError {
- constexpr int error() {
+ constexpr int error() { // pre-cxx23-error {{no return statement in
constexpr function}}
efriedma-quic wrote:
Did you mean to refer to some other issue report? The issue here isn't typo
handling, really; it's that we're discarding the "return" without noting it
anywhere.
https://github.com/llvm/llvm-project/pull/143423
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
AaronBallman wrote: Linux precommit CI failures appear to be unrelated: ``` /usr/bin/ld: cannot find /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/21/lib/x86_64-unknown-linux-gnu/libclang_rt.tysan.a: No such file or directory ``` https://github.com/llvm/llvm-project/pull/143423 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] Remove delayed typo expressions (PR #143423)
AaronBallman wrote: > LGTM, but it’s still missing a release note isn’t it? Absolutely correct. :-D https://github.com/llvm/llvm-project/pull/143423 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
