Skip to content

Commit 7cb5faf

Browse files
authored
[Clang][Driver] Expose -fno-eliminate-unused-debug-types to clang-cl (#95259)
This is used to set DebugInfoKind to "UnusedTypeInfo". This helps in the context of Unreal Engine and NATVIS files that reference unused otherwise `static constexpr` class members. See https://udn.unrealengine.com/s/question/0D5QP00000N012h0AB/fname-debug-visualizer-fails-to-work-with-the-clang-compiler This partially fixes #46924
1 parent 961dd1a commit 7cb5faf

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

clang/docs/UsersManual.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3347,6 +3347,9 @@ below. If multiple flags are present, the last one is used.
33473347
By default, Clang does not emit type information for types that are defined
33483348
but not used in a program. To retain the debug info for these unused types,
33493349
the negation **-fno-eliminate-unused-debug-types** can be used.
3350+
This can be particulary useful on Windows, when using NATVIS files that
3351+
can reference const symbols that would otherwise be stripped, even in full
3352+
debug or standalone debug modes.
33503353

33513354
Controlling Macro Debug Info Generation
33523355
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ def fno_elide_type : Flag<["-"], "fno-elide-type">, Group<f_Group>,
21222122
MarshallingInfoNegativeFlag<DiagnosticOpts<"ElideType">>;
21232123
def feliminate_unused_debug_symbols : Flag<["-"], "feliminate-unused-debug-symbols">, Group<f_Group>;
21242124
defm eliminate_unused_debug_types : OptOutCC1FFlag<"eliminate-unused-debug-types",
2125-
"Do not emit ", "Emit ", " debug info for defined but unused types">;
2125+
"Do not emit ", "Emit ", " debug info for defined but unused types", [ClangOption, CLOption]>;
21262126
def femit_all_decls : Flag<["-"], "femit-all-decls">, Group<f_Group>,
21272127
Visibility<[ClangOption, CC1Option]>,
21282128
HelpText<"Emit all declarations, even if unused">,

clang/test/Driver/cl-options.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,8 @@
698698
// RUN: -Wunused-variable \
699699
// RUN: -fmacro-backtrace-limit=0 \
700700
// RUN: -fstandalone-debug \
701+
// RUN: -feliminate-unused-debug-types \
702+
// RUN: -fno-eliminate-unused-debug-types \
701703
// RUN: -flimit-debug-info \
702704
// RUN: -flto \
703705
// RUN: -fmerge-all-constants \

0 commit comments

Comments
 (0)