ipriyanshi1708 updated this revision to Diff 512421. ipriyanshi1708 added a comment.
Removed the spurious whitespace changes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D147989/new/ https://reviews.llvm.org/D147989 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/include/clang/Sema/DeclSpec.h clang/lib/Sema/SemaDecl.cpp Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -5043,7 +5043,18 @@ llvm_unreachable("unexpected type specifier"); } } - +static unsigned GetDiagnosticTypeSpecifierIDWithAttrs(DeclSpec::TST T, const DeclSpec &DS){ + if (T == DeclSpec::TST_enum) { + if (const EnumDecl *ED = dyn_cast<EnumDecl>(DS.getRepAsDecl())) { + if (ED->isScopedUsingClassTag()) + return 5; + } + } + else{ + return GetDiagnosticTypeSpecifierID(T); + } + return 0; +} /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with /// no declarator (e.g. "struct foo;") is parsed. It also accepts template /// parameters to cope with template friend declarations. @@ -5300,11 +5311,11 @@ TypeSpecType == DeclSpec::TST_enum) { for (const ParsedAttr &AL : DS.getAttributes()) Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored) - << AL << GetDiagnosticTypeSpecifierID(TypeSpecType); + << AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS); for (const ParsedAttr &AL : DeclAttrs) Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored) - << AL << GetDiagnosticTypeSpecifierID(TypeSpecType); - } + << AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS); + } } return TagD; Index: clang/include/clang/Sema/DeclSpec.h =================================================================== --- clang/include/clang/Sema/DeclSpec.h +++ clang/include/clang/Sema/DeclSpec.h @@ -271,7 +271,7 @@ TSC_imaginary, TSC_complex }; - + // Import type specifier type enumeration and constants. typedef TypeSpecifierType TST; static const TST TST_unspecified = clang::TST_unspecified; Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3421,7 +3421,7 @@ InGroup<DeprecatedAttributes>; def warn_declspec_attribute_ignored : Warning< "attribute %0 is ignored, place it after " - "\"%select{class|struct|interface|union|enum}1\" to apply attribute to " + "\"%select{class|struct|interface|union|enum|enum class}1\" to apply attribute to " "type declaration">, InGroup<IgnoredAttributes>; def warn_attribute_precede_definition : Warning< "attribute declaration must precede definition">,
Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -5043,7 +5043,18 @@ llvm_unreachable("unexpected type specifier"); } } - +static unsigned GetDiagnosticTypeSpecifierIDWithAttrs(DeclSpec::TST T, const DeclSpec &DS){ + if (T == DeclSpec::TST_enum) { + if (const EnumDecl *ED = dyn_cast<EnumDecl>(DS.getRepAsDecl())) { + if (ED->isScopedUsingClassTag()) + return 5; + } + } + else{ + return GetDiagnosticTypeSpecifierID(T); + } + return 0; +} /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with /// no declarator (e.g. "struct foo;") is parsed. It also accepts template /// parameters to cope with template friend declarations. @@ -5300,11 +5311,11 @@ TypeSpecType == DeclSpec::TST_enum) { for (const ParsedAttr &AL : DS.getAttributes()) Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored) - << AL << GetDiagnosticTypeSpecifierID(TypeSpecType); + << AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS); for (const ParsedAttr &AL : DeclAttrs) Diag(AL.getLoc(), diag::warn_declspec_attribute_ignored) - << AL << GetDiagnosticTypeSpecifierID(TypeSpecType); - } + << AL << GetDiagnosticTypeSpecifierIDWithAttrs(TypeSpecType,DS); + } } return TagD; Index: clang/include/clang/Sema/DeclSpec.h =================================================================== --- clang/include/clang/Sema/DeclSpec.h +++ clang/include/clang/Sema/DeclSpec.h @@ -271,7 +271,7 @@ TSC_imaginary, TSC_complex }; - + // Import type specifier type enumeration and constants. typedef TypeSpecifierType TST; static const TST TST_unspecified = clang::TST_unspecified; Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3421,7 +3421,7 @@ InGroup<DeprecatedAttributes>; def warn_declspec_attribute_ignored : Warning< "attribute %0 is ignored, place it after " - "\"%select{class|struct|interface|union|enum}1\" to apply attribute to " + "\"%select{class|struct|interface|union|enum|enum class}1\" to apply attribute to " "type declaration">, InGroup<IgnoredAttributes>; def warn_attribute_precede_definition : Warning< "attribute declaration must precede definition">,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits