Add --disable-free flag to clang.
- Disables the freeing of the ASTContext and the TranslationUnit
after parsing & sema.
- Primarily for timing the impact on -fsyntax-only timings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57643 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index ae7ec87..060fbf3 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -54,13 +54,17 @@
// Global options.
//===----------------------------------------------------------------------===//
-bool HadErrors = false;
+static bool HadErrors = false;
static llvm::cl::opt<bool>
Verbose("v", llvm::cl::desc("Enable verbose output"));
static llvm::cl::opt<bool>
Stats("print-stats",
llvm::cl::desc("Print performance metrics and statistics"));
+static llvm::cl::opt<bool>
+DisableFree("disable-free",
+ llvm::cl::desc("Disable freeing of memory on exit"),
+ llvm::cl::init(false));
enum ProgActions {
RewriteObjC, // ObjC->C Rewriter.
@@ -1187,7 +1191,7 @@
if (VerifyDiagnostics)
exit(CheckASTConsumer(PP, Consumer.get()));
- ParseAST(PP, Consumer.get(), Stats);
+ ParseAST(PP, Consumer.get(), Stats, !DisableFree);
} else {
if (VerifyDiagnostics)
exit(CheckDiagnostics(PP));