[cfe-commits] r139499 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Modules/module-private.cpp
Douglas Gregor
dgregor at apple.com
Mon Sep 12 09:11:25 PDT 2011
Author: dgregor
Date: Mon Sep 12 11:11:24 2011
New Revision: 139499
URL: http://llvm.org/viewvc/llvm-project?rev=139499&view=rev
Log:
Allow __module_private__ on fields
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Modules/module-private.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=139499&r1=139498&r2=139499&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Sep 12 11:11:24 2011
@@ -8079,6 +8079,9 @@
if (NewFD->isInvalidDecl())
Record->setInvalidDecl();
+ if (D.getDeclSpec().isModulePrivateSpecified())
+ NewFD->setModulePrivate();
+
if (NewFD->isInvalidDecl() && PrevDecl) {
// Don't introduce NewFD into scope; there's already something
// with the same name in the same scope.
@@ -8556,6 +8559,9 @@
if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(NewID))
NewID->setInvalidDecl();
+ if (D.getDeclSpec().isModulePrivateSpecified())
+ NewID->setModulePrivate();
+
if (II) {
// FIXME: When interfaces are DeclContexts, we'll need to add
// these to the interface.
Modified: cfe/trunk/test/Modules/module-private.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/module-private.cpp?rev=139499&r1=139498&r2=139499&view=diff
==============================================================================
--- cfe/trunk/test/Modules/module-private.cpp (original)
+++ cfe/trunk/test/Modules/module-private.cpp Mon Sep 12 11:11:24 2011
@@ -40,6 +40,12 @@
inline void test_f0_in_right() {
double &dr = f0(hidden_var);
}
+
+struct VisibleStruct {
+ __module_private__ int field;
+ __module_private__ void setField(int f);
+};
+
#else
__import_module__ left;
__import_module__ right;
@@ -60,6 +66,10 @@
// expected-error{{expected '(' for function-style cast or type construction}} \
// expected-error{{use of undeclared identifier 'vec'}}
+ VisibleStruct vs;
+ vs.field = 0; // expected-error{{no member named 'field' in 'VisibleStruct'}}
+ vs.setField(1); // expected-error{{no member named 'setField' in 'VisibleStruct'}}
+
return hidden_var; // expected-error{{use of undeclared identifier 'hidden_var'}}
}
More information about the cfe-commits
mailing list