[cfe-commits] r102050 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/Sema.h lib/Sema/SemaAccess.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp
Anders Carlsson
andersca at mac.com
Wed Apr 21 22:40:53 PDT 2010
Author: andersca
Date: Thu Apr 22 00:40:53 2010
New Revision: 102050
URL: http://llvm.org/viewvc/llvm-project?rev=102050&view=rev
Log:
Re-land the patch that merges two diagnostics into one now that it passes self-host :)
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaAccess.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=102050&r1=102049&r2=102050&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Apr 22 00:40:53 2010
@@ -459,16 +459,15 @@
def err_access_ctor :
Error<"calling a %select{private|protected}0 constructor of class %2">,
NoSFINAE;
-def err_access_ctor_base :
- Error<"base class %0 has %select{private|protected}1 constructor">,
- NoSFINAE;
+
+def err_access_base : Error<
+ "%select{base class|inherited virtual base class}0 %1 has %select{private|"
+ "protected}3 %select{constructor|copy constructor|copy assignment operator|"
+ "destructor}2">, 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">,
- NoSFINAE;
def err_access_dtor_base :
Error<"base class %0 has %select{private|protected}1 destructor">,
NoSFINAE;
@@ -2932,9 +2931,9 @@
def error_ivar_use_in_class_method : Error<
"instance variable %0 accessed in class method">;
def error_private_ivar_access : Error<"instance variable %0 is private">,
- NoSFINAE;
+ NoSFINAE;
def error_protected_ivar_access : Error<"instance variable %0 is protected">,
- NoSFINAE;
+ NoSFINAE;
def warn_maynot_respond : Warning<"%0 may not respond to %1">;
def warn_attribute_method_def : Warning<
"method attribute can only be specified on method declarations">;
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=102050&r1=102049&r2=102050&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Thu Apr 22 00:40:53 2010
@@ -924,12 +924,14 @@
Declarator *D = 0);
enum CXXSpecialMember {
- CXXDefaultConstructor = 0,
+ CXXInvalid = -1,
+ CXXConstructor = 0,
CXXCopyConstructor = 1,
CXXCopyAssignment = 2,
CXXDestructor = 3
};
void DiagnoseNontrivial(const RecordType* Record, CXXSpecialMember mem);
+ CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD);
virtual DeclPtrTy ActOnIvar(Scope *S, SourceLocation DeclStart,
DeclPtrTy IntfDecl,
Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=102050&r1=102049&r2=102050&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Thu Apr 22 00:40:53 2010
@@ -1143,14 +1143,13 @@
AccessEntity.setDiag(diag::err_access_ctor);
break;
- case InitializedEntity::EK_Base: {
- unsigned DiagID = Entity.isInheritedVirtualBase() ?
- diag::err_access_ctor_vbase : diag::err_access_ctor_base;
- AccessEntity.setDiag(PDiag(DiagID)
- << Entity.getBaseSpecifier()->getType());
+ case InitializedEntity::EK_Base:
+ AccessEntity.setDiag(PDiag(diag::err_access_base)
+ << Entity.isInheritedVirtualBase()
+ << Entity.getBaseSpecifier()->getType()
+ << getSpecialMember(Constructor));
break;
- }
-
+
case InitializedEntity::EK_Member: {
const FieldDecl *Field = cast<FieldDecl>(Entity.getDecl());
AccessEntity.setDiag(PDiag(diag::err_access_ctor_field)
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=102050&r1=102049&r2=102050&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Apr 22 00:40:53 2010
@@ -924,13 +924,12 @@
/// getSpecialMember - get the special member enum for a method.
-static Sema::CXXSpecialMember getSpecialMember(ASTContext &Ctx,
- const CXXMethodDecl *MD) {
+Sema::CXXSpecialMember Sema::getSpecialMember(const CXXMethodDecl *MD) {
if (const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(MD)) {
- if (Ctor->isDefaultConstructor())
- return Sema::CXXDefaultConstructor;
if (Ctor->isCopyConstructor())
return Sema::CXXCopyConstructor;
+
+ return Sema::CXXConstructor;
}
if (isa<CXXDestructorDecl>(MD))
@@ -1112,7 +1111,7 @@
} else {
Diag(NewMethod->getLocation(),
diag::err_definition_of_implicitly_declared_member)
- << New << getSpecialMember(Context, OldMethod);
+ << New << getSpecialMember(OldMethod);
return true;
}
}
@@ -5616,21 +5615,17 @@
// because otherwise we'll never get complaints about
// copy constructors.
- const CXXSpecialMember invalid = (CXXSpecialMember) -1;
-
- CXXSpecialMember member;
+ CXXSpecialMember member = CXXInvalid;
if (!RDecl->hasTrivialCopyConstructor())
member = CXXCopyConstructor;
else if (!RDecl->hasTrivialConstructor())
- member = CXXDefaultConstructor;
+ member = CXXConstructor;
else if (!RDecl->hasTrivialCopyAssignment())
member = CXXCopyAssignment;
else if (!RDecl->hasTrivialDestructor())
member = CXXDestructor;
- else
- member = invalid;
- if (member != invalid) {
+ if (member != CXXInvalid) {
Diag(Loc, diag::err_illegal_union_member) << Name << member;
DiagnoseNontrivial(RT, member);
NewFD->setInvalidDecl();
@@ -5672,7 +5667,7 @@
// Check whether the member was user-declared.
switch (member) {
- case CXXDefaultConstructor:
+ case CXXConstructor:
if (RD->hasUserDeclaredConstructor()) {
typedef CXXRecordDecl::ctor_iterator ctor_iter;
for (ctor_iter ci = RD->ctor_begin(), ce = RD->ctor_end(); ci != ce;++ci){
@@ -5746,7 +5741,7 @@
bool (CXXRecordDecl::*hasTrivial)() const;
switch (member) {
- case CXXDefaultConstructor:
+ case CXXConstructor:
hasTrivial = &CXXRecordDecl::hasTrivialConstructor; break;
case CXXCopyConstructor:
hasTrivial = &CXXRecordDecl::hasTrivialCopyConstructor; break;
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=102050&r1=102049&r2=102050&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Apr 22 00:40:53 2010
@@ -3912,7 +3912,7 @@
CurContext = Constructor;
if (SetBaseOrMemberInitializers(Constructor, 0, 0, /*AnyErrors=*/false)) {
Diag(CurrentLocation, diag::note_member_synthesized_at)
- << CXXDefaultConstructor << Context.getTagDeclType(ClassDecl);
+ << CXXConstructor << Context.getTagDeclType(ClassDecl);
Constructor->setInvalidDecl();
} else {
Constructor->setUsed();
More information about the cfe-commits
mailing list