[PATCH] D132521: [AST] Reuse PrintingPolicy from ASTContext

Youngsuk Kim via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 23 18:41:35 PDT 2022


JOE1994 created this revision.
Herald added a project: All.
JOE1994 requested review of this revision.
Herald added a project: clang.

No need to create a duplicate PrintingPolicy when we can reuse the
PrintingPolicy from ASTContext.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132521

Files:
  clang/lib/Frontend/ASTConsumers.cpp


Index: clang/lib/Frontend/ASTConsumers.cpp
===================================================================
--- clang/lib/Frontend/ASTConsumers.cpp
+++ clang/lib/Frontend/ASTConsumers.cpp
@@ -92,7 +92,7 @@
         } else
           Out << "Not a DeclContext\n";
       } else if (OutputKind == Print) {
-        PrintingPolicy Policy(D->getASTContext().getLangOpts());
+        PrintingPolicy &Policy = D->getASTContext().getPrintingPolicy();
         D->print(Out, Policy, /*Indentation=*/0, /*PrintInstantiation=*/true);
       } else if (OutputKind != None) {
         D->dump(Out, OutputKind == DumpFull, OutputFormat);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132521.455038.patch
Type: text/x-patch
Size: 628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220824/8dbf96a1/attachment.bin>


More information about the cfe-commits mailing list