From 6f70fae14ec0bcfc6bbd698a73047d15eea96eee Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 15 Apr 2014 01:19:35 +0000 Subject: [PATCH] Partial revert of r206229, to get the build bots green again. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206237 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/ParseDeclCXX.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index be2349985e..56e116ef39 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -3254,14 +3254,15 @@ bool Parser::ParseCXX11AttributeArgs(IdentifierInfo *AttrName, // 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 (!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 (NumArgs && !Attr->getMaxArgs()) { - // The attribute parsed successfully, but was not allowed to have any - // arguments. It doesn't matter whether any were provided -- the + 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. + // 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()) { + // 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. Diag(LParenLoc, diag::err_cxx11_attribute_forbids_arguments) << AttrName; -- 2.40.0