[PATCH] D111973: [clang] Disable -clear-ast-before-backend with -print-stats

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 17 23:23:46 PDT 2021


aeubanks created this revision.
aeubanks added a reviewer: dblaikie.
aeubanks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

We still need access to various things in the ASTContext when printing stats.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111973

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Misc/clear-ast-before-backend.c


Index: clang/test/Misc/clear-ast-before-backend.c
===================================================================
--- clang/test/Misc/clear-ast-before-backend.c
+++ clang/test/Misc/clear-ast-before-backend.c
@@ -1,3 +1,4 @@
 // RUN: %clang_cc1 -clear-ast-before-backend %s -emit-obj -o /dev/null -O1
+// RUN: %clang_cc1 -clear-ast-before-backend %s -emit-obj -o /dev/null -print-stats
 
 void f() {}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -454,6 +454,8 @@
   CodeGenOpts.XRayAlwaysEmitTypedEvents = LangOpts.XRayAlwaysEmitTypedEvents;
   CodeGenOpts.DisableFree = FrontendOpts.DisableFree;
   FrontendOpts.GenerateGlobalModuleIndex = FrontendOpts.UseGlobalModuleIndex;
+  if (FrontendOpts.ShowStats)
+    CodeGenOpts.ClearASTBeforeBackend = false;
   LangOpts.SanitizeCoverage = CodeGenOpts.hasSanitizeCoverage();
   LangOpts.ForceEmitVTables = CodeGenOpts.ForceEmitVTables;
   LangOpts.SpeculativeLoadHardening = CodeGenOpts.SpeculativeLoadHardening;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111973.380281.patch
Type: text/x-patch
Size: 1129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211018/7244ad9c/attachment.bin>


More information about the cfe-commits mailing list