diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst index f954857b0235af..d36db8a01949c3 100644 --- a/clang/docs/UsersManual.rst +++ b/clang/docs/UsersManual.rst @@ -3338,6 +3338,9 @@ below. If multiple flags are present, the last one is used. By default, Clang does not emit type information for types that are defined but not used in a program. To retain the debug info for these unused types, the negation **-fno-eliminate-unused-debug-types** can be used. + This can be particulary useful on Windows, when using NATVIS files that + can reference const symbols that would otherwise be stripped, even in full + debug or standalone debug modes. Controlling Macro Debug Info Generation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 9f7904dd94b94e..b75d67551bc97a 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2120,7 +2120,7 @@ def fno_elide_type : Flag<["-"], "fno-elide-type">, Group, MarshallingInfoNegativeFlag>; def feliminate_unused_debug_symbols : Flag<["-"], "feliminate-unused-debug-symbols">, Group; defm eliminate_unused_debug_types : OptOutCC1FFlag<"eliminate-unused-debug-types", - "Do not emit ", "Emit ", " debug info for defined but unused types">; + "Do not emit ", "Emit ", " debug info for defined but unused types", [ClangOption, CLOption]>; def femit_all_decls : Flag<["-"], "femit-all-decls">, Group, Visibility<[ClangOption, CC1Option]>, HelpText<"Emit all declarations, even if unused">, diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 2c17459dde656a..d7d7c5c8258158 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -696,6 +696,8 @@ // RUN: -Wunused-variable \ // RUN: -fmacro-backtrace-limit=0 \ // RUN: -fstandalone-debug \ +// RUN: -feliminate-unused-debug-types \ +// RUN: -fno-eliminate-unused-debug-types \ // RUN: -flimit-debug-info \ // RUN: -flto \ // RUN: -fmerge-all-constants \