[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-09-20 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment. Submitted for review https://reviews.llvm.org/D38109 - [fixup][Sema] Allow in C to define tags inside enumerations. Repository: rL LLVM https://reviews.llvm.org/D37089 ___ cfe-commits mailing list

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-09-20 Thread Alberto Magni via Phabricator via cfe-commits
alberto_magni added a comment. Yes, restricting the error to C++ would work. Many thanks. Repository: rL LLVM https://reviews.llvm.org/D37089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

Re: [PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-09-20 Thread Aaron Ballman via cfe-commits
On Wed, Sep 20, 2017 at 2:17 PM, Volodymyr Sapsai via Phabricator via cfe-commits wrote: > vsapsai added a comment. > > Thanks for following up, Alberto. I haven't expected such a use case. It is > possible to achieve the same with `LSA_SIZEOF_SA =

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-09-20 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment. Thanks for following up, Alberto. I haven't expected such a use case. It is possible to achieve the same with `LSA_SIZEOF_SA = sizeof(((len_and_sockaddr *)0)->u)` but I don't like it and don't want to force developers using such approach. For solving this problem I

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-09-20 Thread Alberto Magni via Phabricator via cfe-commits
alberto_magni added a comment. Hi all, this change is causing busybox to fail to compile. The faulty enum is here: https://git.busybox.net/busybox/tree/include/libbb.h#n639 The nested union is inside a sizeof statement. Something like this: enum { A = sizeof(union { int x; int

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-09-15 Thread Volodymyr Sapsai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. vsapsai marked an inline comment as done. Closed by commit rL313386: [Sema] Error out early for tags defined inside an enumeration. (authored by vsapsai). Changed prior to commit:

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-09-14 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai marked an inline comment as done. vsapsai added inline comments. Comment at: clang/test/Sema/enum.c:128 +// PR28903 +struct PR28903 { // expected-warning {{empty struct is a GNU extension}} + enum { rnk wrote: > This is a simpler test case that fixes

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-09-14 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai updated this revision to Diff 115333. vsapsai added a comment. - Remove extraneous diagnostics in test case per Reid Kleckner feedback. https://reviews.llvm.org/D37089 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Sema/SemaDecl.cpp clang/test/Sema/enum.c

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-09-14 Thread Doug Gregor via Phabricator via cfe-commits
doug.gregor accepted this revision. doug.gregor added a comment. This revision is now accepted and ready to land. Looks good to me; sorry for the delay. https://reviews.llvm.org/D37089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-09-13 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment. I think this looks good, even without fixing the access control crash, this seems like a diagnostic improvement. Comment at: clang/test/Sema/enum.c:128 +// PR28903 +struct PR28903 { // expected-warning {{empty struct is a GNU extension}} + enum {

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-09-12 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment. Ping. If you don't have time to review the change in depth, please say if the approach is wrong on high level. https://reviews.llvm.org/D37089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-08-28 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment. It occurred to me that another approach for fixing the crash can be setting `IsTypeSpecifier` to `true` while we ParseCastExpression. According to cast-expression: unary-expression ( type-id ) cast-expression type-id: type-specifier-seq

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-08-23 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment. I have also considered adding tests for structs and unions defined inside an enumeration but decided it doesn't add much value, given the code is working for all TagDecl. Another option I had in mind is having a note pointing to outer enum. But the nesting is done in

[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

2017-08-23 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai created this revision. This fixes PR28903 by avoiding access check for inner enum constant. We are performing access check because one enum constant references another and because enum is defined in CXXRecordDecl. But access check doesn't work because FindDeclaringClass doesn't expect