[cfe-commits] r131706 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaAccess.cpp test/CXX/class.access/p4.cpp

Matt Beaumont-Gay matthewbg at google.com
Thu May 19 16:44:42 PDT 2011


Author: matthewbg
Date: Thu May 19 18:44:42 2011
New Revision: 131706

URL: http://llvm.org/viewvc/llvm-project?rev=131706&view=rev
Log:
Undo enough of r131143 to make private copy ctor diags say "copy constructor" again

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaAccess.cpp
    cfe/trunk/test/CXX/class.access/p4.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=131706&r1=131705&r2=131706&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu May 19 18:44:42 2011
@@ -603,9 +603,10 @@
   AccessControl, InGroup<BindToTemporaryCopy>;
 def err_access_base_ctor : Error<
   "%select{base class|inherited virtual base class}0 %1 has %select{private|"
-  "protected}2 constructor">, AccessControl;
+  "protected}3 %select{|copy }2constructor">, AccessControl;
 def err_access_field_ctor : Error<
-  "field of type %0 has %select{private|protected}1 constructor">, AccessControl;
+  "field of type %0 has %select{private|protected}2 "
+  "%select{|copy }1constructor">, AccessControl;
 
 def err_access_ctor_field :
     Error<"field of type %1 has %select{private|protected}2 constructor">,

Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=131706&r1=131705&r2=131706&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Thu May 19 18:44:42 2011
@@ -1425,13 +1425,17 @@
   case InitializedEntity::EK_Base:
     AccessEntity.setDiag(PDiag(diag::err_access_base_ctor)
                           << Entity.isInheritedVirtualBase()
-                          << Entity.getBaseSpecifier()->getType());
+                          << Entity.getBaseSpecifier()->getType()
+                          << (getSpecialMember(Constructor) ==
+                              Sema::CXXCopyConstructor));
     break;
 
   case InitializedEntity::EK_Member: {
     const FieldDecl *Field = cast<FieldDecl>(Entity.getDecl());
     AccessEntity.setDiag(PDiag(diag::err_access_field_ctor)
-                          << Field->getType());
+                          << Field->getType()
+                          << (getSpecialMember(Constructor) ==
+                              Sema::CXXCopyConstructor));
     break;
   }
 

Modified: cfe/trunk/test/CXX/class.access/p4.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.access/p4.cpp?rev=131706&r1=131705&r2=131706&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class.access/p4.cpp (original)
+++ cfe/trunk/test/CXX/class.access/p4.cpp Thu May 19 18:44:42 2011
@@ -224,12 +224,12 @@
     private: A(const A &); // expected-note 2 {{declared private here}}
   };
 
-  class Test1 { A a; }; // expected-error {{field of type 'test6::A' has private constructor}}
+  class Test1 { A a; }; // expected-error {{field of type 'test6::A' has private copy constructor}}
   void test1(const Test1 &t) {
     Test1 a = t; // expected-note{{implicit default copy}}
   }
 
-  class Test2 : A {}; // expected-error {{base class 'test6::A' has private constructor}}
+  class Test2 : A {}; // expected-error {{base class 'test6::A' has private copy constructor}}
   void test2(const Test2 &t) {
     Test2 a = t; // expected-note{{implicit default copy}}
   }





More information about the cfe-commits mailing list