}
static bool classof(StaticAssertDecl *D) { return true; }
};
+
+/// Insertion operator for diagnostics. This allows sending AccessSpecifier's
+/// into a diagnostic with <<.
+const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+ AccessSpecifier AS);
} // end namespace clang
ak_identifierinfo, // IdentifierInfo
ak_qualtype, // QualType
ak_declarationname, // DeclarationName
- ak_nameddecl // NamedDecl *
+ ak_nameddecl, // NamedDecl *
+ ak_accessspecifier // AccessSpecifier
};
private:
StaticAssertDecl::~StaticAssertDecl() {
}
+static const char *getAccessName(AccessSpecifier AS) {
+ switch (AS) {
+ default:
+ case AS_none:
+ assert("Invalid access specifier!");
+ return 0;
+ case AS_public:
+ return "public";
+ case AS_private:
+ return "private";
+ case AS_protected:
+ return "protected";
+ }
+}
+
+const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB,
+ AccessSpecifier AS) {
+ return DB << getAccessName(AS);
+}
+
+
Fn->setDeleted();
}
-static const char *getAccessName(AccessSpecifier AS) {
- switch (AS) {
- default:
- case AS_none:
- assert("Invalid access specifier!");
- return 0;
- case AS_public:
- return "public";
- case AS_private:
- return "private";
- case AS_protected:
- return "protected";
- }
-}
-
bool Sema::SetMemberAccessSpecifier(NamedDecl *MemberDecl,
NamedDecl *PrevMemberDecl,
AccessSpecifier LexicalAS) {
if (LexicalAS != AS_none && LexicalAS != PrevMemberDecl->getAccess()) {
Diag(MemberDecl->getLocation(),
diag::err_class_redeclared_with_different_access)
- << MemberDecl << getAccessName(LexicalAS);
+ << MemberDecl << LexicalAS;
Diag(PrevMemberDecl->getLocation(), diag::note_previous_access_declaration)
- << PrevMemberDecl << getAccessName(PrevMemberDecl->getAccess());
+ << PrevMemberDecl << PrevMemberDecl->getAccess();
return true;
}