r206229 - Fixing a typo, updating the diagnostic wording and logic based on post-commit review feedback. Amends r206186.
Aaron Ballman
aaron at aaronballman.com
Mon Apr 14 17:36:40 PDT 2014
Author: aaronballman
Date: Mon Apr 14 19:36:39 2014
New Revision: 206229
URL: http://llvm.org/viewvc/llvm-project?rev=206229&view=rev
Log:
Fixing a typo, updating the diagnostic wording and logic based on post-commit review feedback. Amends r206186.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.c
cfe/trunk/test/Parser/cxx0x-attributes.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=206229&r1=206228&r2=206229&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Mon Apr 14 19:36:39 2014
@@ -527,8 +527,8 @@ def warn_cxx98_compat_attribute : Warnin
InGroup<CXX98Compat>, DefaultIgnore;
def err_cxx11_attribute_forbids_arguments : Error<
"attribute %0 cannot have an argument list">;
-def err_attribute_requires_arguements : Error<
- "attribute %0 requires a nonempty argument list">;
+def err_attribute_requires_arguments : Error<
+ "parentheses must be omitted if %0 attribute's argument list is empty">;
def err_cxx11_attribute_forbids_ellipsis : Error<
"attribute '%0' cannot be used as an attribute pack">;
def err_cxx11_attribute_repeated : Error<
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=206229&r1=206228&r2=206229&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Mon Apr 14 19:36:39 2014
@@ -517,7 +517,7 @@ bool Parser::ParseMicrosoftDeclSpecArgs(
// arguments but none were provided, emit a diagnostic.
const AttributeList *Attr = Attrs.getList();
if (Attr && Attr->getMaxArgs() && !NumArgs) {
- Diag(OpenParenLoc, diag::err_attribute_requires_arguements) << AttrName;
+ Diag(OpenParenLoc, diag::err_attribute_requires_arguments) << AttrName;
return false;
}
return true;
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=206229&r1=206228&r2=206229&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Mon Apr 14 19:36:39 2014
@@ -3254,12 +3254,12 @@ bool Parser::ParseCXX11AttributeArgs(Ide
// parsing an argument list, we need to determine whether this attribute
// was allowed to have an argument list (such as [[deprecated]]), and how
// many arguments were parsed (so we can diagnose on [[deprecated()]]).
- if (Attr->getMaxArgs() && !NumArgs) {
- // 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_arguements) << AttrName;
+ if (!NumArgs) {
+ // Diagnose an empty argument list when parenthesis are present.
+ // FIXME: This is a good place for a fixit which removes the parens.
+ Diag(LParenLoc, diag::err_attribute_requires_arguments) << AttrName;
return false;
- } else if (!Attr->getMaxArgs()) {
+ } else if (NumArgs && !Attr->getMaxArgs()) {
// The attribute parsed successfully, but was not allowed to have any
// arguments. It doesn't matter whether any were provided -- the
// presence of the argument list (even if empty) is diagnosed.
Modified: cfe/trunk/test/Parser/MicrosoftExtensions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.c?rev=206229&r1=206228&r2=206229&view=diff
==============================================================================
--- cfe/trunk/test/Parser/MicrosoftExtensions.c (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.c Mon Apr 14 19:36:39 2014
@@ -104,7 +104,7 @@ struct __declspec("testing") S3 {}; /* e
/* declspecs with arguments cannot have an empty argument list, even if the
arguments are optional. */
-__declspec(deprecated()) void dep_func_test(void); /* expected-error {{attribute 'deprecated' requires a nonempty argument list}} */
+__declspec(deprecated()) void dep_func_test(void); /* expected-error {{parentheses must be omitted if 'deprecated' attribute's argument list is empty}} */
__declspec(deprecated) void dep_func_test2(void);
__declspec(deprecated("")) void dep_func_test3(void);
Modified: cfe/trunk/test/Parser/cxx0x-attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-attributes.cpp?rev=206229&r1=206228&r2=206229&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx0x-attributes.cpp (original)
+++ cfe/trunk/test/Parser/cxx0x-attributes.cpp Mon Apr 14 19:36:39 2014
@@ -326,6 +326,6 @@ namespace GccASan {
namespace {
[[deprecated]] void bar();
[[deprecated("hello")]] void baz();
- [[deprecated()]] void foo(); // expected-error {{attribute 'deprecated' requires a nonempty argument list}}
+ [[deprecated()]] void foo(); // expected-error {{parentheses must be omitted if 'deprecated' attribute's argument list is empty}}
[[gnu::deprecated()]] void quux();
}
More information about the cfe-commits
mailing list