diff options
| -rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 4 | ||||
| -rw-r--r-- | clang/test/SemaCXX/attr-cxx0x-fixit.cpp | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 01f91eb26d8..e2a51ecfca4 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -3469,7 +3469,6 @@ bool Parser::ParseCXX11AttributeArgs(IdentifierInfo *AttrName, 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()) { @@ -3477,7 +3476,8 @@ bool Parser::ParseCXX11AttributeArgs(IdentifierInfo *AttrName, // 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; + << AttrName + << FixItHint::CreateRemoval(SourceRange(LParenLoc, *EndLoc)); return false; } } diff --git a/clang/test/SemaCXX/attr-cxx0x-fixit.cpp b/clang/test/SemaCXX/attr-cxx0x-fixit.cpp new file mode 100644 index 00000000000..6a6cdc11288 --- /dev/null +++ b/clang/test/SemaCXX/attr-cxx0x-fixit.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -std=c++11 %s 2>&1 | FileCheck %s
+
+[[noreturn()]] void f(); // expected-error {{attribute 'noreturn' cannot have an argument list}} \
+// CHECK: fix-it:"{{.*}}":{4:11-4:13}:""
|

