]> granicus.if.org Git - clang/commitdiff
Simplify diagnosis of misplaced attributes in module-declarations.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 15 Apr 2019 23:55:58 +0000 (23:55 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 15 Apr 2019 23:55:58 +0000 (23:55 +0000)
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358463 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/Parser.cpp

index febb0f942e8ed0a6584897d62ce5841765857175..6b25d6c038be09648ed965fa5252bebfd72e2d83 100644 (file)
@@ -2170,8 +2170,8 @@ Parser::DeclGroupPtrTy Parser::ParseModuleDecl(bool IsFirstDecl) {
   SourceLocation ModuleLoc = ConsumeToken();
 
   // Attributes appear after the module name, not before.
-  if (Tok.is(tok::l_square))
-    CheckProhibitedCXX11Attribute();
+  // FIXME: Suggest moving the attributes later with a fixit.
+  DiagnoseAndSkipCXX11Attributes();
 
   // Parse a global-module-fragment, if present.
   if (getLangOpts().CPlusPlusModules && Tok.is(tok::semi)) {
@@ -2197,8 +2197,7 @@ Parser::DeclGroupPtrTy Parser::ParseModuleDecl(bool IsFirstDecl) {
     }
     ConsumeToken();
     SourceLocation PrivateLoc = ConsumeToken();
-    if (Tok.is(tok::l_square))
-      CheckProhibitedCXX11Attribute();
+    DiagnoseAndSkipCXX11Attributes();
     ExpectAndConsumeSemi(diag::err_private_module_fragment_expected_semi);
     return Actions.ActOnPrivateModuleFragmentDecl(ModuleLoc, PrivateLoc);
   }