[cfe-commits] r139497 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Sema/DeclSpec.cpp test/Modules/module-private.cpp

Douglas Gregor dgregor at apple.com
Mon Sep 12 08:48:15 PDT 2011


Author: dgregor
Date: Mon Sep 12 10:48:15 2011
New Revision: 139497

URL: http://llvm.org/viewvc/llvm-project?rev=139497&view=rev
Log:
Remove the restriction on module-private friends. Since the friend
declaration may be the first declaration, we want the ability to that
declaration to be marked module-private.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
    cfe/trunk/lib/Sema/DeclSpec.cpp
    cfe/trunk/test/Modules/module-private.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=139497&r1=139496&r2=139497&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Mon Sep 12 10:48:15 2011
@@ -582,8 +582,6 @@
   "expected a module name after '__import_module__'">;
 def err_module_expected_semi : Error<
   "expected a semicolon name after module name">;
-def err_module_private_friend : Error<
-  "friend cannot be declared __module_private__">;
 }
 
 } // end of Parser diagnostics

Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=139497&r1=139496&r2=139497&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Mon Sep 12 10:48:15 2011
@@ -899,13 +899,6 @@
     ClearStorageClassSpecs();
   }
 
-  // A friend cannot be specified as module-private.
-  if (isFriendSpecified() && isModulePrivateSpecified()) {
-    Diag(D, ModulePrivateLoc, diag::err_module_private_friend)
-      << FixItHint::CreateRemoval(ModulePrivateLoc);
-    ModulePrivateLoc = SourceLocation();
-  }
-
   assert(!TypeSpecOwned || isDeclRep((TST) TypeSpecType));
  
   // Okay, now we can infer the real type.

Modified: cfe/trunk/test/Modules/module-private.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/module-private.cpp?rev=139497&r1=139496&r2=139497&view=diff
==============================================================================
--- cfe/trunk/test/Modules/module-private.cpp (original)
+++ cfe/trunk/test/Modules/module-private.cpp Mon Sep 12 10:48:15 2011
@@ -96,8 +96,8 @@
   struct inner_struct;
   static int static_var;
 
-  friend __module_private__ void public_func(); // expected-error{{friend cannot be declared __module_private__}}
-  friend __module_private__ struct public_struct; // expected-error{{friend cannot be declared __module_private__}}
+  friend __module_private__ void public_func_friend();
+  friend __module_private__ struct public_struct_friend;
 };
 
 template<> __module_private__ struct public_class<int>::inner_struct { }; // expected-error{{member specialization cannot be declared __module_private__}}





More information about the cfe-commits mailing list