]> granicus.if.org Git - clang/commitdiff
In DeclPrinter, assert when asked to print AS_None.
authorAnders Carlsson <andersca@mac.com>
Sat, 29 Aug 2009 20:36:12 +0000 (20:36 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 29 Aug 2009 20:36:12 +0000 (20:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80437 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclPrinter.cpp

index 51e15bdbe0ff5e097bc45b6afc417d33fcd9be2a..191d356755f9489f063dbdc589fde5a2170ffe22 100644 (file)
@@ -169,7 +169,7 @@ void DeclPrinter::ProcessDeclGroup(llvm::SmallVectorImpl<Decl*>& Decls) {
 
 void DeclPrinter::Print(AccessSpecifier AS) {
   switch(AS) {
-  case AS_none:      break;
+  case AS_none:      assert(0 && "No access specifier!"); break;
   case AS_public:    Out << "public"; break;
   case AS_protected: Out << "protected"; break;
   case AS_private:   Out << " private"; break;
@@ -565,7 +565,9 @@ void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) {
         if (Base->isVirtual())
           Out << "virtual ";
 
-        Print(Base->getAccessSpecifierAsWritten());
+        AccessSpecifier AS = Base->getAccessSpecifierAsWritten();
+        if (AS != AS_none)
+          Print(AS);
         Out << " " << Base->getType().getAsString(Policy);
       }
     }
@@ -867,5 +869,3 @@ void DeclPrinter::VisitUnresolvedUsingDecl(UnresolvedUsingDecl *D) {
   D->getTargetNestedNameSpecifier()->print(Out, Policy);
   Out << D->getTargetName().getAsString();
 }
-
-