llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-driver Author: Chandler Carruth (chandlerc) <details> <summary>Changes</summary> This lets us pass `-no-disable-free` to re-enable freeing memory for example. This is especially helpful for library users of Clang where it is important to not slowly leak memory. --- Full diff: https://github.com/llvm/llvm-project/pull/136213.diff 2 Files Affected: - (modified) clang/include/clang/Driver/Options.td (+7-3) - (modified) clang/test/Driver/clang-translation.c (+3) ``````````diff diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index e9acb20348654..830d3459a1320 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -7889,9 +7889,13 @@ def code_completion_with_fixits : Flag<["-"], "code-completion-with-fixits">, def skip_function_bodies : Flag<["-"], "skip-function-bodies">, HelpText<"Skip function bodies when possible">, MarshallingInfoFlag<FrontendOpts<"SkipFunctionBodies">>; -def disable_free : Flag<["-"], "disable-free">, - HelpText<"Disable freeing of memory on exit">, - MarshallingInfoFlag<FrontendOpts<"DisableFree">>; +defm disable_free : BoolOption<"", + "disable-free", + FrontendOpts<"DisableFree">, + DefaultFalse, + PosFlag<SetTrue, [], [ClangOption], "Disable">, + NegFlag<SetFalse, [], [ClangOption], "Don't disable">, + BothFlags<[], [ClangOption], " freeing of memory on exit">>; defm clear_ast_before_backend : BoolOption<"", "clear-ast-before-backend", CodeGenOpts<"ClearASTBeforeBackend">, diff --git a/clang/test/Driver/clang-translation.c b/clang/test/Driver/clang-translation.c index a7343ea18b213..1c9e3cfb2a5e5 100644 --- a/clang/test/Driver/clang-translation.c +++ b/clang/test/Driver/clang-translation.c @@ -10,6 +10,9 @@ // I386: "-o" // I386: clang-translation +// RUN: %clang -target i386-unknown-unknown -### -S -O0 -Os %s -o %t.s -fverbose-asm -fvisibility=hidden -no-disable-free 2>&1 | FileCheck -check-prefix=FREE %s +// FREE-NOT: "-disable-free" + // RUN: %clang -target i386-unknown-unknown -### -S %s -fasynchronous-unwind-tables -fno-unwind-tables 2>&1 | FileCheck --check-prefix=UNWIND-TABLES %s --implicit-check-not=warning: // UNWIND-TABLES: "-funwind-tables=2" `````````` </details> https://github.com/llvm/llvm-project/pull/136213 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits