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

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

Differential Revision: https://reviews.llvm.org/D111973
This commit is contained in:
Arthur Eubanks 2021-10-17 22:48:35 -07:00
parent f2c144fc18
commit ab41a1c505
2 changed files with 8 additions and 0 deletions

View File

@ -454,6 +454,8 @@ static bool FixupInvocation(CompilerInvocation &Invocation,
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;

View File

@ -1,3 +1,9 @@
// 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 2>&1 | FileCheck %s
// CHECK: *** Decl Stats:
// CHECK: {{.*}} decls total
// CHECK: 1 Function decls
// CHECK: Total bytes =
void f() {}