[cfe-commits] r102025 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaAccess.cpp
Anders Carlsson
andersca at mac.com
Wed Apr 21 13:28:29 PDT 2010
Author: andersca
Date: Wed Apr 21 15:28:29 2010
New Revision: 102025
URL: http://llvm.org/viewvc/llvm-project?rev=102025&view=rev
Log:
Diagnose access to fields with private constructors.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaAccess.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=102025&r1=102024&r2=102025&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Apr 21 15:28:29 2010
@@ -462,6 +462,9 @@
def err_access_ctor_base :
Error<"base class %0 has %select{private|protected}1 constructor">,
NoSFINAE;
+def err_access_ctor_field :
+ Error<"field of type %1 has %select{private|protected}2 constructor">,
+ NoSFINAE;
def err_access_ctor_vbase :
Error<"inherited virtual base class %0 has "
"%select{private|protected}1 constructor">,
Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=102025&r1=102024&r2=102025&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Wed Apr 21 15:28:29 2010
@@ -1150,6 +1150,13 @@
<< Entity.getBaseSpecifier()->getType());
break;
}
+
+ case InitializedEntity::EK_Member: {
+ const FieldDecl *Field = cast<FieldDecl>(Entity.getDecl());
+ AccessEntity.setDiag(PDiag(diag::err_access_ctor_field)
+ << Field->getDeclName() << Field->getType());
+ break;
+ }
}
More information about the cfe-commits
mailing list