[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-24 Thread Nathan Ridge via cfe-commits
https://github.com/HighCommander4 closed https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-24 Thread Nathan Ridge via cfe-commits
https://github.com/HighCommander4 updated https://github.com/llvm/llvm-project/pull/88645 >From d8236b6a2feb27538fc131c30768d2247b7b86cb Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sun, 14 Apr 2024 02:41:48 -0400 Subject: [PATCH] [clang][Sema] Preserve the initializer of invalid VarDecls

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-24 Thread Nathan Ridge via cfe-commits
@@ -13435,16 +13435,18 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc, void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { // If there is no declaration, there was an error parsing it. Just ignore // the initializer. - if

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-24 Thread Nathan Ridge via cfe-commits
https://github.com/HighCommander4 updated https://github.com/llvm/llvm-project/pull/88645 >From c24e79da57fc69d2f353a5533a3cc26313301a71 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sun, 14 Apr 2024 02:41:48 -0400 Subject: [PATCH] [clang][Sema] Preserve the initializer of invalid VarDecls

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-24 Thread Nathan Ridge via cfe-commits
https://github.com/HighCommander4 edited https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-24 Thread Nathan Ridge via cfe-commits
@@ -13435,16 +13435,18 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc, void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { // If there is no declaration, there was an error parsing it. Just ignore // the initializer. - if

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-22 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-22 Thread Matheus Izvekov via cfe-commits
@@ -13456,6 +13458,15 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { return; } + if (VDecl->isInvalidDecl()) { +CorrectDelayedTyposInExpr(Init, VDecl); +ExprResult Recovery = +CreateRecoveryExpr(Init->getBeginLoc(),

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-22 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-22 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov deleted https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-22 Thread Matheus Izvekov via cfe-commits
@@ -13456,6 +13458,15 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { return; } + if (VDecl->isInvalidDecl()) { +CorrectDelayedTyposInExpr(Init, VDecl); +ExprResult Recovery = +CreateRecoveryExpr(Init->getBeginLoc(),

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-22 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-22 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-22 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM, Thanks! https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-22 Thread Matheus Izvekov via cfe-commits
@@ -13435,16 +13435,18 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc, void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { // If there is no declaration, there was an error parsing it. Just ignore // the initializer. - if

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-22 Thread Nathan Ridge via cfe-commits
HighCommander4 wrote: @mizvekov does the updated patch look reasonable to you? https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-15 Thread Nathan Ridge via cfe-commits
https://github.com/HighCommander4 updated https://github.com/llvm/llvm-project/pull/88645 >From b43d8ddf8846db8a77d01c9fb2d246a0d0ba2ab2 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sun, 14 Apr 2024 02:41:48 -0400 Subject: [PATCH] [clang][Sema] Preserve the initializer of invalid VarDecls

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-15 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 9617da88ab961145047076c45bb2bb1ac4513634 07424d8ee99fc418d071960bbdd4185564025139 --

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-15 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Nathan Ridge (HighCommander4) Changes Fixes https://github.com/clangd/clangd/issues/1821 --- Full diff: https://github.com/llvm/llvm-project/pull/88645.diff 3 Files Affected: - (modified) clang/lib/Sema/JumpDiagnostics.cpp (+2-1) -

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-15 Thread Nathan Ridge via cfe-commits
https://github.com/HighCommander4 ready_for_review https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-15 Thread Nathan Ridge via cfe-commits
HighCommander4 wrote: > I added a new test case. However, the patch currently fails two existing test > cases: > > Clang :: Parser/cxx-class.cpp > Clang :: SemaCXX/cxx1z-init-statement.cpp > > I will leave the PR as a Draft while I investigate these failures. The latest version of the patch

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-15 Thread Nathan Ridge via cfe-commits
https://github.com/HighCommander4 updated https://github.com/llvm/llvm-project/pull/88645 >From 07424d8ee99fc418d071960bbdd4185564025139 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sun, 14 Apr 2024 02:41:48 -0400 Subject: [PATCH] [clang][Sema] Preserve the initializer of invalid VarDecls

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-15 Thread Nathan Ridge via cfe-commits
HighCommander4 wrote: > Thanks for the improvement! > > Can you also add a test case? Thanks for the feedback! I added a new test case. However, the patch currently fails two existing test cases: Clang :: Parser/cxx-class.cpp Clang :: SemaCXX/cxx1z-init-statement.cpp I will leave the

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-15 Thread Nathan Ridge via cfe-commits
@@ -13456,6 +13455,14 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { return; } + if (VDecl->isInvalidDecl()) { +CorrectDelayedTyposInExpr(Init, VDecl); +VDecl->setInit( +CreateRecoveryExpr(Init->getBeginLoc(),

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-15 Thread Nathan Ridge via cfe-commits
@@ -13435,8 +13435,7 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc, void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { // If there is no declaration, there was an error parsing it. Just ignore // the initializer. - if

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-15 Thread Nathan Ridge via cfe-commits
https://github.com/HighCommander4 updated https://github.com/llvm/llvm-project/pull/88645 >From 97170ed63643832f305254ba1788b99f90f9330d Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sun, 14 Apr 2024 02:41:48 -0400 Subject: [PATCH] [clang][Sema] Preserve the initializer of invalid VarDecls

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-14 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov requested changes to this pull request. Thanks for the improvement! Can you also add a test case? https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-14 Thread Matheus Izvekov via cfe-commits
@@ -13456,6 +13455,14 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { return; } + if (VDecl->isInvalidDecl()) { +CorrectDelayedTyposInExpr(Init, VDecl); +VDecl->setInit( +CreateRecoveryExpr(Init->getBeginLoc(),

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-14 Thread Matheus Izvekov via cfe-commits
@@ -13435,8 +13435,7 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc, void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { // If there is no declaration, there was an error parsing it. Just ignore // the initializer. - if

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-14 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/88645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Preserve the initializer of invalid VarDecls (PR #88645)

2024-04-14 Thread Nathan Ridge via cfe-commits
https://github.com/HighCommander4 created https://github.com/llvm/llvm-project/pull/88645 Fixes https://github.com/clangd/clangd/issues/1821 >From 42ee794d3de89241fae7314db2202cac32af469b Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sun, 14 Apr 2024 02:41:48 -0400 Subject: [PATCH]