]> granicus.if.org Git - clang/commitdiff
DeclPrinter: Indent access specifiers.
authorDaniel Dunbar <daniel@zuster.org>
Sat, 21 Nov 2009 09:12:06 +0000 (09:12 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 21 Nov 2009 09:12:06 +0000 (09:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89552 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclPrinter.cpp

index 131de8b2e11ba4e5ee5bc9ddec069ebeab4e51c2..864f1145a07bd35d990fd218644358a40218185a 100644 (file)
@@ -30,7 +30,8 @@ namespace {
     PrintingPolicy Policy;
     unsigned Indentation;
 
-    llvm::raw_ostream& Indent();
+    llvm::raw_ostream& Indent() { return Indent(Indentation); }
+    llvm::raw_ostream& Indent(unsigned Indentation);
     void ProcessDeclGroup(llvm::SmallVectorImpl<Decl*>& Decls);
 
     void Print(AccessSpecifier AS);
@@ -154,8 +155,8 @@ void Decl::dump() const {
   print(llvm::errs());
 }
 
-llvm::raw_ostream& DeclPrinter::Indent() {
-  for (unsigned i = 0; i < Indentation; ++i)
+llvm::raw_ostream& DeclPrinter::Indent(unsigned Indentation) {
+  for (unsigned i = 0; i != Indentation; ++i)
     Out << "  ";
   return Out;
 }
@@ -205,6 +206,8 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) {
       AccessSpecifier AS = D->getAccess();
 
       if (AS != CurAS) {
+        if (Indent)
+          this->Indent(Indentation - Policy.Indentation);
         Print(AS);
         Out << ":\n";
         CurAS = AS;