Author: aaronballman Date: Tue Mar 8 15:31:32 2016 New Revision: 262960 URL: http://llvm.org/viewvc/llvm-project?rev=262960&view=rev Log: Silence duplicate diagnostics because parsing of a standards-based attribute triggers parsing diagnostics that may also be picked up during semantic analysis.
Added: cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp cfe/trunk/test/Parser/cxx0x-attributes.cpp Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=262960&r1=262959&r2=262960&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original) +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Tue Mar 8 15:31:32 2016 @@ -3695,6 +3695,7 @@ bool Parser::ParseCXX11AttributeArgs(Ide // The attribute was allowed to have arguments, but none were provided // even though the attribute parsed successfully. This is an error. Diag(LParenLoc, diag::err_attribute_requires_arguments) << AttrName; + Attr->setInvalid(true); } else if (!Attr->getMaxArgs()) { // The attribute parsed successfully, but was not allowed to have any // arguments. It doesn't matter whether any were provided -- the @@ -3702,6 +3703,7 @@ bool Parser::ParseCXX11AttributeArgs(Ide Diag(LParenLoc, diag::err_cxx11_attribute_forbids_arguments) << AttrName << FixItHint::CreateRemoval(SourceRange(LParenLoc, *EndLoc)); + Attr->setInvalid(true); } } } Added: cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp?rev=262960&view=auto ============================================================================== --- cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp (added) +++ cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp Tue Mar 8 15:31:32 2016 @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++1z -verify %s + +struct [[nodiscard]] S1 {}; // ok +struct [[nodiscard nodiscard]] S2 {}; // expected-error {{attribute 'nodiscard' cannot appear multiple times in an attribute specifier}} +struct [[nodiscard("Wrong")]] S3 {}; // expected-error {{'nodiscard' cannot have an argument list}} + +[[nodiscard]] int f(); +enum [[nodiscard]] E {}; Modified: cfe/trunk/test/Parser/cxx0x-attributes.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-attributes.cpp?rev=262960&r1=262959&r2=262960&view=diff ============================================================================== --- cfe/trunk/test/Parser/cxx0x-attributes.cpp (original) +++ cfe/trunk/test/Parser/cxx0x-attributes.cpp Tue Mar 8 15:31:32 2016 @@ -336,7 +336,6 @@ namespace { // expected-warning@-1 {{use of the 'deprecated' attribute is a C++14 extension}} [[deprecated()]] void foo(); // expected-error@-1 {{parentheses must be omitted if 'deprecated' attribute's argument list is empty}} - // expected-warning@-2 {{use of the 'deprecated' attribute is a C++14 extension}} [[gnu::deprecated()]] void quux(); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits