From 54915054af8699aecc2267e09f13de3c2164926a Mon Sep 17 00:00:00 2001 From: Michael Teper Date: Tue, 19 Jan 2016 15:34:46 -0800 Subject: [PATCH] [AST] Formatting consistency in conditional compilation output Before: ``` (#if_stmt (#if: (stuff) #else (stuff)) ``` After: ``` (#if_stmt (#if: (stuff)) (#else: (stuff))) ``` Notable differences: - #if block is closed - #else block is treated same as #if block, starts on new line, token terminated with `:` - #else block is closed --- lib/AST/ASTDumper.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index 96e34164b750e..af6d00e956dfb 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -952,7 +952,7 @@ namespace { OS.indent(Indent) << "(#if_decl\n"; Indent += 2; for (auto &Clause : ICD->getClauses()) { - OS.indent(Indent) << (Clause.Cond ? "(#if:\n" : "#else"); + OS.indent(Indent) << (Clause.Cond ? "(#if:\n" : "\n(#else:\n"); if (Clause.Cond) printRec(Clause.Cond); @@ -960,6 +960,8 @@ namespace { OS << '\n'; printRec(D); } + + OS << ')'; } Indent -= 2;