as it does something unexpected (but gcc compatible).
Suggest use of __attribute__((visibility("hidden")))
on declaration instead. // rdar://
7703982
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161972
91177308-0d34-0410-b5e6-
96231b3b80d8
def ObjCReceiver : DiagGroup<"receiver-expr">;
def OverlengthStrings : DiagGroup<"overlength-strings">;
def OverloadedVirtual : DiagGroup<"overloaded-virtual">;
+def PrivateExtern : DiagGroup<"private-extern">;
def ObjCPropertyImpl : DiagGroup<"objc-property-implementation">;
def ObjCPropertyNoAttribute : DiagGroup<"objc-property-no-attribute">;
def ObjCMissingSuperCalls : DiagGroup<"objc-missing-super-calls">;
Unused,
VolatileRegisterVar,
ObjCMissingSuperCalls,
- OverloadedVirtual
+ OverloadedVirtual,
+ PrivateExtern
]>;
// Thread Safety warnings
"%0 is not literal because it has a user-provided destructor">;
def note_non_literal_nontrivial_dtor : Note<
"%0 is not literal because it has a non-trivial destructor">;
+def warn_private_extern : Warning<
+ "Use of __private_extern__ on tentative definition has unexpected"
+ " behaviour - use __attribute__((visibility(\"hidden\"))) on extern"
+ " declaration or definition instead">,
+ InGroup<PrivateExtern>, DefaultIgnore;
// C++11 char16_t/char32_t
def warn_cxx98_compat_unicode_type : Warning<
diag::err_abstract_type_in_decl,
AbstractVariableType))
Var->setInvalidDecl();
+ if (!Type->isDependentType() && !Var->isInvalidDecl() &&
+ Var->getStorageClass() == SC_PrivateExtern)
+ Diag(Var->getLocation(), diag::warn_private_extern);
+
return;
case VarDecl::TentativeDefinition:
-// RUN: %clang_cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -Wprivate-extern -verify
// PR3310
struct a x1; // expected-note 2{{forward declaration of 'struct a'}}
static int i3 = 5;
extern int i3;
-__private_extern__ int pExtern;
+// rdar://7703982
+__private_extern__ int pExtern; // expected-warning {{Use of __private_extern__ on tentative definition has unexpected behaviour}}
int pExtern = 0;
int i4;