llvm-project/clang/lib
Volodymyr Sapsai 8b0bbc6fe0 [Sema] Error out early for tags defined inside an enumeration.
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 more than one EnumDecl
and because inner enum has access AS_none due to not being an immediate
child of a record.

The change detects an enum is defined in wrong place and allows to skip
parsing its body. Access check is skipped together with body parsing.
There was no crash in C, added test case to cover the new error.

rdar://problem/28530809

Reviewers: rnk, doug.gregor, rsmith

Reviewed By: doug.gregor

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D37089

llvm-svn: 313386
2017-09-15 19:51:42 +00:00
..
ARCMigrate Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-03 06:23:19 +00:00
AST Fix the __interface inheritence rules to work better with IUnknown and IDispatch 2017-09-15 16:03:35 +00:00
ASTMatchers Add objcImplementationDecl matcher 2017-09-10 21:00:15 +00:00
Analysis Recommit "Add _Float16 as a C/C++ source language type" 2017-09-08 15:15:00 +00:00
Basic [Module map] Introduce a private module re-export directive. 2017-09-14 23:38:44 +00:00
CodeGen Mark static member functions as static in CodeViewDebug 2017-09-13 20:53:55 +00:00
Driver [MSan] Specify use-after-dtor default value in header. 2017-09-14 23:53:56 +00:00
Edit [clang] Fix format specifiers fixits for nested macros 2017-06-20 20:46:58 +00:00
Format [clang-format] New flag - BraceWrapping.AfterExternBlock 2017-09-15 11:23:50 +00:00
Frontend Add /System/Library/PrivateFrameworks as a header search path. 2017-09-14 23:38:44 +00:00
FrontendTool Update after LLVM change r309087 2017-07-26 09:10:17 +00:00
Headers [CUDA] Work around a new quirk in CUDA9 headers. 2017-09-15 17:30:53 +00:00
Index Recommit "Add _Float16 as a C/C++ source language type" 2017-09-08 15:15:00 +00:00
Lex [Module map] Introduce a private module re-export directive. 2017-09-14 23:38:44 +00:00
Parse Recommit "Add _Float16 as a C/C++ source language type" 2017-09-08 15:15:00 +00:00
Rewrite [Analyzer] Add support for displaying cross-file diagnostic paths in HTML output 2017-08-03 18:12:22 +00:00
Sema [Sema] Error out early for tags defined inside an enumeration. 2017-09-15 19:51:42 +00:00
Serialization Minor cleanups to address feedback from Bruno. NFC 2017-09-14 23:40:51 +00:00
StaticAnalyzer [Analyzer] Check function name size before indexing. 2017-09-15 19:51:26 +00:00
Tooling [refactor] Use CommonOptionsParser in clang-refactor 2017-09-14 13:16:14 +00:00
CMakeLists.txt