[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-02 Thread via cfe-commits

github-actions[bot] wrote:



@a-tarasyuk Congratulations on having your first Pull Request (PR) merged into 
the LLVM Project!

Your changes will be combined with recent changes from other authors, then 
tested
by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with 
a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as
the builds can include changes from many authors. It is not uncommon for your
change to be included in a build that fails due to someone else's changes, or
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail 
[here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr).

If your change does cause a problem, it may be reverted, or you can revert it 
yourself.
This is a normal part of [LLVM 
development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy).
 You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are 
working as expected, well done!


https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-02 Thread via cfe-commits

https://github.com/cor3ntin closed 
https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread Oleksandr T. via cfe-commits

a-tarasyuk wrote:

@cor3ntin If no additional feedback is needed, it would be great if you could 
proceed with the merge. thanks

https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread Oleksandr T. via cfe-commits

a-tarasyuk wrote:

If no additional feedback is needed, it would be great if you could proceed 
with the merge. thanks

https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread via cfe-commits

https://github.com/cor3ntin approved this pull request.

LGTM.
Congratulations on your first contribution!

Will you need me to merge that PR for you?

https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread Oleksandr T. via cfe-commits


@@ -630,6 +630,7 @@ Bug Fixes to C++ Support
 - Fix a bug on template partial specialization with issue on deduction of 
nontype template parameter
   whose type is `decltype(auto)`. Fixes (#GH68885).
 - Clang now correctly treats the noexcept-specifier of a friend function to be 
a complete-class context.
+- Fix crash caused by missing invocation of ``setInvalidDecl()`` for invalid 
``Anon`` declarations. (#GH85447)

a-tarasyuk wrote:

Oke, thanks 

https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk deleted 
https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread Oleksandr T. via cfe-commits


@@ -630,6 +630,7 @@ Bug Fixes to C++ Support
 - Fix a bug on template partial specialization with issue on deduction of 
nontype template parameter
   whose type is `decltype(auto)`. Fixes (#GH68885).
 - Clang now correctly treats the noexcept-specifier of a friend function to be 
a complete-class context.
+- Fix crash caused by missing invocation of ``setInvalidDecl()`` for invalid 
``Anon`` declarations. (#GH85447)

a-tarasyuk wrote:

Oke

https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/89850

>From f4e4e7b91e85d12c861063e1461b160b9bd22da6 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Mon, 29 Apr 2024 01:53:47 +0300
Subject: [PATCH 1/2] fix(85447): refine handling of incomplete anonymous
 struct declarations

---
 clang/lib/Sema/SemaDecl.cpp|  3 +++
 clang/test/Sema/incomplete-struct-decl.cpp | 10 ++
 2 files changed, 13 insertions(+)
 create mode 100644 clang/test/Sema/incomplete-struct-decl.cpp

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 671752b56e01f4..d3871bb7447405 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, 
DeclSpec ,
 Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
Record->getLocation(), /*IdentifierInfo=*/nullptr,
Context.getTypeDeclType(Record), TInfo, SC);
+if (Invalid)
+  Anon->setInvalidDecl();
+
 ProcessDeclAttributes(S, Anon, Dc);
 
 // Default-initialize the implicit variable. This initialization will be
diff --git a/clang/test/Sema/incomplete-struct-decl.cpp 
b/clang/test/Sema/incomplete-struct-decl.cpp
new file mode 100644
index 00..bc3bd6b2eae2f0
--- /dev/null
+++ b/clang/test/Sema/incomplete-struct-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx,expected %s
+
+template  using __impl_of = a; // expected-note {{'__impl_of' 
declared here}} \
+   expected-note {{template is 
declared here}}
+struct {// expected-error {{anonymous structs 
and classes must be class members}} \
+   expected-note {{to match this '{'}}
+  __impl_;  // expected-error {{no template named 
'__impl_'; did you mean '__impl_of'?}} \
+   expected-error {{cannot specify 
deduction guide for alias template '__impl_of'}} \
+   expected-error {{expected ';' after 
struct}}
+// expected-error {{expected '}'}}

>From fedc5eab0765ae999d849a49eba88a995f558405 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Wed, 1 May 2024 16:35:17 +0300
Subject: [PATCH 2/2] update changelog

---
 clang/docs/ReleaseNotes.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 2c5308fbcb319a..a146dedb125a34 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -630,6 +630,7 @@ Bug Fixes to C++ Support
 - Fix a bug on template partial specialization with issue on deduction of 
nontype template parameter
   whose type is `decltype(auto)`. Fixes (#GH68885).
 - Clang now correctly treats the noexcept-specifier of a friend function to be 
a complete-class context.
+- Fix an assertion failure when parsing an invalid members of an anonymous 
class. (#GH85447)
 
 Bug Fixes to AST Handling
 ^

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread via cfe-commits


@@ -630,6 +630,7 @@ Bug Fixes to C++ Support
 - Fix a bug on template partial specialization with issue on deduction of 
nontype template parameter
   whose type is `decltype(auto)`. Fixes (#GH68885).
 - Clang now correctly treats the noexcept-specifier of a friend function to be 
a complete-class context.
+- Fix crash caused by missing invocation of ``setInvalidDecl()`` for invalid 
``Anon`` declarations. (#GH85447)

cor3ntin wrote:

Maybe "Fix an assertion failure when parsing an invalid members of an anonymous 
class" (the changelog is user facing)

https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/89850

>From f4e4e7b91e85d12c861063e1461b160b9bd22da6 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Mon, 29 Apr 2024 01:53:47 +0300
Subject: [PATCH 1/2] fix(85447): refine handling of incomplete anonymous
 struct declarations

---
 clang/lib/Sema/SemaDecl.cpp|  3 +++
 clang/test/Sema/incomplete-struct-decl.cpp | 10 ++
 2 files changed, 13 insertions(+)
 create mode 100644 clang/test/Sema/incomplete-struct-decl.cpp

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 671752b56e01f4..d3871bb7447405 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, 
DeclSpec ,
 Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
Record->getLocation(), /*IdentifierInfo=*/nullptr,
Context.getTypeDeclType(Record), TInfo, SC);
+if (Invalid)
+  Anon->setInvalidDecl();
+
 ProcessDeclAttributes(S, Anon, Dc);
 
 // Default-initialize the implicit variable. This initialization will be
diff --git a/clang/test/Sema/incomplete-struct-decl.cpp 
b/clang/test/Sema/incomplete-struct-decl.cpp
new file mode 100644
index 00..bc3bd6b2eae2f0
--- /dev/null
+++ b/clang/test/Sema/incomplete-struct-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx,expected %s
+
+template  using __impl_of = a; // expected-note {{'__impl_of' 
declared here}} \
+   expected-note {{template is 
declared here}}
+struct {// expected-error {{anonymous structs 
and classes must be class members}} \
+   expected-note {{to match this '{'}}
+  __impl_;  // expected-error {{no template named 
'__impl_'; did you mean '__impl_of'?}} \
+   expected-error {{cannot specify 
deduction guide for alias template '__impl_of'}} \
+   expected-error {{expected ';' after 
struct}}
+// expected-error {{expected '}'}}

>From b6ea2516c966be1ed1f432fecc37f0a5b464a747 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Wed, 1 May 2024 15:47:32 +0300
Subject: [PATCH 2/2] update changelog

---
 clang/docs/ReleaseNotes.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 64a523a6f25fc2..5c7a9db4a5ad9c 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -590,6 +590,7 @@ Bug Fixes to C++ Support
 - Fixed a use-after-free bug in parsing of type constraints with default 
arguments that involve lambdas. (#GH67235)
 - Fixed bug in which the body of a consteval lambda within a template was not 
parsed as within an
   immediate function context.
+- Fix crash caused by missing invocation of ``setInvalidDecl()`` for invalid 
``Anon`` declarations. (#GH85447)
 
 Bug Fixes to AST Handling
 ^

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/89850

>From f4e4e7b91e85d12c861063e1461b160b9bd22da6 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Mon, 29 Apr 2024 01:53:47 +0300
Subject: [PATCH 1/2] fix(85447): refine handling of incomplete anonymous
 struct declarations

---
 clang/lib/Sema/SemaDecl.cpp|  3 +++
 clang/test/Sema/incomplete-struct-decl.cpp | 10 ++
 2 files changed, 13 insertions(+)
 create mode 100644 clang/test/Sema/incomplete-struct-decl.cpp

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 671752b56e01f4..d3871bb7447405 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, 
DeclSpec ,
 Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
Record->getLocation(), /*IdentifierInfo=*/nullptr,
Context.getTypeDeclType(Record), TInfo, SC);
+if (Invalid)
+  Anon->setInvalidDecl();
+
 ProcessDeclAttributes(S, Anon, Dc);
 
 // Default-initialize the implicit variable. This initialization will be
diff --git a/clang/test/Sema/incomplete-struct-decl.cpp 
b/clang/test/Sema/incomplete-struct-decl.cpp
new file mode 100644
index 00..bc3bd6b2eae2f0
--- /dev/null
+++ b/clang/test/Sema/incomplete-struct-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx,expected %s
+
+template  using __impl_of = a; // expected-note {{'__impl_of' 
declared here}} \
+   expected-note {{template is 
declared here}}
+struct {// expected-error {{anonymous structs 
and classes must be class members}} \
+   expected-note {{to match this '{'}}
+  __impl_;  // expected-error {{no template named 
'__impl_'; did you mean '__impl_of'?}} \
+   expected-error {{cannot specify 
deduction guide for alias template '__impl_of'}} \
+   expected-error {{expected ';' after 
struct}}
+// expected-error {{expected '}'}}

>From b6ea2516c966be1ed1f432fecc37f0a5b464a747 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Wed, 1 May 2024 15:47:32 +0300
Subject: [PATCH 2/2] update changelog

---
 clang/docs/ReleaseNotes.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 64a523a6f25fc2..5c7a9db4a5ad9c 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -590,6 +590,7 @@ Bug Fixes to C++ Support
 - Fixed a use-after-free bug in parsing of type constraints with default 
arguments that involve lambdas. (#GH67235)
 - Fixed bug in which the body of a consteval lambda within a template was not 
parsed as within an
   immediate function context.
+- Fix crash caused by missing invocation of ``setInvalidDecl()`` for invalid 
``Anon`` declarations. (#GH85447)
 
 Bug Fixes to AST Handling
 ^

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread via cfe-commits

cor3ntin wrote:

@a-tarasyuk in `clang/docs/ReleaseNotes.rst`, you should add an entry in the 
"Bug Fixes to C++ Support" section.
it should be a short description indicating `Fixes (#GH85447)`

https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-05-01 Thread Oleksandr T. via cfe-commits

a-tarasyuk wrote:

@cor3ntin Thanks for pointing this out. I've updated the PR description. Were 
you referring to this changelog, or is there something else I should add?

https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-04-29 Thread Oleksandr T. via cfe-commits

a-tarasyuk wrote:

@cor3ntin Thanks for pointing this out. I've updated the PR description. Were 
you referring to this changelog, or is there something else I should add?

https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-04-29 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk edited 
https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-04-29 Thread via cfe-commits

cor3ntin wrote:

Can you add a changelog entry indicating the issue fixed?

https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-04-28 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/89850

>From f4e4e7b91e85d12c861063e1461b160b9bd22da6 Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Mon, 29 Apr 2024 01:53:47 +0300
Subject: [PATCH] fix(85447): refine handling of incomplete anonymous struct
 declarations

---
 clang/lib/Sema/SemaDecl.cpp|  3 +++
 clang/test/Sema/incomplete-struct-decl.cpp | 10 ++
 2 files changed, 13 insertions(+)
 create mode 100644 clang/test/Sema/incomplete-struct-decl.cpp

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 671752b56e01f4..d3871bb7447405 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, 
DeclSpec ,
 Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
Record->getLocation(), /*IdentifierInfo=*/nullptr,
Context.getTypeDeclType(Record), TInfo, SC);
+if (Invalid)
+  Anon->setInvalidDecl();
+
 ProcessDeclAttributes(S, Anon, Dc);
 
 // Default-initialize the implicit variable. This initialization will be
diff --git a/clang/test/Sema/incomplete-struct-decl.cpp 
b/clang/test/Sema/incomplete-struct-decl.cpp
new file mode 100644
index 00..bc3bd6b2eae2f0
--- /dev/null
+++ b/clang/test/Sema/incomplete-struct-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx,expected %s
+
+template  using __impl_of = a; // expected-note {{'__impl_of' 
declared here}} \
+   expected-note {{template is 
declared here}}
+struct {// expected-error {{anonymous structs 
and classes must be class members}} \
+   expected-note {{to match this '{'}}
+  __impl_;  // expected-error {{no template named 
'__impl_'; did you mean '__impl_of'?}} \
+   expected-error {{cannot specify 
deduction guide for alias template '__impl_of'}} \
+   expected-error {{expected ';' after 
struct}}
+// expected-error {{expected '}'}}

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-04-28 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/89850

>From 484100917d034bc30131ebb95578d09083a2325a Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Wed, 24 Apr 2024 03:27:52 +0300
Subject: [PATCH] fix(85447): refine handling of incomplete anonymous struct
 declarations

---
 clang/lib/Sema/SemaDecl.cpp|  3 +++
 clang/test/Sema/incomplete-struct-decl.cpp | 10 ++
 2 files changed, 13 insertions(+)
 create mode 100644 clang/test/Sema/incomplete-struct-decl.cpp

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5fed554d9e25c3..debe0d9e865362 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, 
DeclSpec ,
 Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
Record->getLocation(), /*IdentifierInfo=*/nullptr,
Context.getTypeDeclType(Record), TInfo, SC);
+if (Invalid)
+  Anon->setInvalidDecl();
+
 ProcessDeclAttributes(S, Anon, Dc);
 
 // Default-initialize the implicit variable. This initialization will be
diff --git a/clang/test/Sema/incomplete-struct-decl.cpp 
b/clang/test/Sema/incomplete-struct-decl.cpp
new file mode 100644
index 00..21e445fa170f94
--- /dev/null
+++ b/clang/test/Sema/incomplete-struct-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+template  using __impl_of = a; // expected-note {{'__impl_of' 
declared here}} \
+   expected-note {{template is 
declared here}}
+struct {// expected-error {{anonymous structs 
and classes must be class members}} \
+   expected-note {{to match this '{'}}
+  __impl_;  // expected-error {{no template named 
'__impl_'; did you mean '__impl_of'?}} \
+   expected-error {{cannot specify 
deduction guide for alias template '__impl_of'}} \
+   expected-error {{expected ';' after 
struct}}
+// expected-error {{expected '}'}}

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-04-24 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/89850

>From 484100917d034bc30131ebb95578d09083a2325a Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Wed, 24 Apr 2024 03:27:52 +0300
Subject: [PATCH] fix(85447): refine handling of incomplete anonymous struct
 declarations

---
 clang/lib/Sema/SemaDecl.cpp|  3 +++
 clang/test/Sema/incomplete-struct-decl.cpp | 10 ++
 2 files changed, 13 insertions(+)
 create mode 100644 clang/test/Sema/incomplete-struct-decl.cpp

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5fed554d9e25c3..debe0d9e865362 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, 
DeclSpec ,
 Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
Record->getLocation(), /*IdentifierInfo=*/nullptr,
Context.getTypeDeclType(Record), TInfo, SC);
+if (Invalid)
+  Anon->setInvalidDecl();
+
 ProcessDeclAttributes(S, Anon, Dc);
 
 // Default-initialize the implicit variable. This initialization will be
diff --git a/clang/test/Sema/incomplete-struct-decl.cpp 
b/clang/test/Sema/incomplete-struct-decl.cpp
new file mode 100644
index 00..21e445fa170f94
--- /dev/null
+++ b/clang/test/Sema/incomplete-struct-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+template  using __impl_of = a; // expected-note {{'__impl_of' 
declared here}} \
+   expected-note {{template is 
declared here}}
+struct {// expected-error {{anonymous structs 
and classes must be class members}} \
+   expected-note {{to match this '{'}}
+  __impl_;  // expected-error {{no template named 
'__impl_'; did you mean '__impl_of'?}} \
+   expected-error {{cannot specify 
deduction guide for alias template '__impl_of'}} \
+   expected-error {{expected ';' after 
struct}}
+// expected-error {{expected '}'}}

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-04-24 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/89850

>From 484100917d034bc30131ebb95578d09083a2325a Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Wed, 24 Apr 2024 03:27:52 +0300
Subject: [PATCH] fix(85447): refine handling of incomplete anonymous struct
 declarations

---
 clang/lib/Sema/SemaDecl.cpp|  3 +++
 clang/test/Sema/incomplete-struct-decl.cpp | 10 ++
 2 files changed, 13 insertions(+)
 create mode 100644 clang/test/Sema/incomplete-struct-decl.cpp

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5fed554d9e25c3..debe0d9e865362 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, 
DeclSpec ,
 Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
Record->getLocation(), /*IdentifierInfo=*/nullptr,
Context.getTypeDeclType(Record), TInfo, SC);
+if (Invalid)
+  Anon->setInvalidDecl();
+
 ProcessDeclAttributes(S, Anon, Dc);
 
 // Default-initialize the implicit variable. This initialization will be
diff --git a/clang/test/Sema/incomplete-struct-decl.cpp 
b/clang/test/Sema/incomplete-struct-decl.cpp
new file mode 100644
index 00..21e445fa170f94
--- /dev/null
+++ b/clang/test/Sema/incomplete-struct-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+template  using __impl_of = a; // expected-note {{'__impl_of' 
declared here}} \
+   expected-note {{template is 
declared here}}
+struct {// expected-error {{anonymous structs 
and classes must be class members}} \
+   expected-note {{to match this '{'}}
+  __impl_;  // expected-error {{no template named 
'__impl_'; did you mean '__impl_of'?}} \
+   expected-error {{cannot specify 
deduction guide for alias template '__impl_of'}} \
+   expected-error {{expected ';' after 
struct}}
+// expected-error {{expected '}'}}

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-04-23 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Oleksandr T. (a-tarasyuk)


Changes

Fixes #85447

---
Full diff: https://github.com/llvm/llvm-project/pull/89850.diff


2 Files Affected:

- (modified) clang/lib/Sema/SemaDecl.cpp (+3) 
- (added) clang/test/Sema/incomplete-struct-decl.cpp (+10) 


``diff
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5fed554d9e25c3..debe0d9e865362 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, 
DeclSpec ,
 Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
Record->getLocation(), /*IdentifierInfo=*/nullptr,
Context.getTypeDeclType(Record), TInfo, SC);
+if (Invalid)
+  Anon->setInvalidDecl();
+
 ProcessDeclAttributes(S, Anon, Dc);
 
 // Default-initialize the implicit variable. This initialization will be
diff --git a/clang/test/Sema/incomplete-struct-decl.cpp 
b/clang/test/Sema/incomplete-struct-decl.cpp
new file mode 100644
index 00..21e445fa170f94
--- /dev/null
+++ b/clang/test/Sema/incomplete-struct-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+template  using __impl_of = a; // expected-note {{'__impl_of' 
declared here}} \
+   expected-note {{template is 
declared here}}
+struct {// expected-error {{anonymous structs 
and classes must be class members}} \
+   expected-note {{to match this '{'}}
+  __impl_;  // expected-error {{no template named 
'__impl_'; did you mean '__impl_of'?}} \
+   expected-error {{cannot specify 
deduction guide for alias template '__impl_of'}} \
+   expected-error {{expected ';' after 
struct}}
+// expected-error {{expected '}'}}

``




https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-04-23 Thread via cfe-commits

github-actions[bot] wrote:



Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from 
other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

https://github.com/llvm/llvm-project/pull/89850
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl (PR #89850)

2024-04-23 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk created 
https://github.com/llvm/llvm-project/pull/89850

Fixes #85447

>From 484100917d034bc30131ebb95578d09083a2325a Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Wed, 24 Apr 2024 03:27:52 +0300
Subject: [PATCH] fix(85447): refine handling of incomplete anonymous struct
 declarations

---
 clang/lib/Sema/SemaDecl.cpp|  3 +++
 clang/test/Sema/incomplete-struct-decl.cpp | 10 ++
 2 files changed, 13 insertions(+)
 create mode 100644 clang/test/Sema/incomplete-struct-decl.cpp

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5fed554d9e25c3..debe0d9e865362 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5789,6 +5789,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, 
DeclSpec ,
 Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
Record->getLocation(), /*IdentifierInfo=*/nullptr,
Context.getTypeDeclType(Record), TInfo, SC);
+if (Invalid)
+  Anon->setInvalidDecl();
+
 ProcessDeclAttributes(S, Anon, Dc);
 
 // Default-initialize the implicit variable. This initialization will be
diff --git a/clang/test/Sema/incomplete-struct-decl.cpp 
b/clang/test/Sema/incomplete-struct-decl.cpp
new file mode 100644
index 00..21e445fa170f94
--- /dev/null
+++ b/clang/test/Sema/incomplete-struct-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+template  using __impl_of = a; // expected-note {{'__impl_of' 
declared here}} \
+   expected-note {{template is 
declared here}}
+struct {// expected-error {{anonymous structs 
and classes must be class members}} \
+   expected-note {{to match this '{'}}
+  __impl_;  // expected-error {{no template named 
'__impl_'; did you mean '__impl_of'?}} \
+   expected-error {{cannot specify 
deduction guide for alias template '__impl_of'}} \
+   expected-error {{expected ';' after 
struct}}
+// expected-error {{expected '}'}}

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits