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;
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;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits