Stop messing with the 'g' group of options in CompilerInvocation.


Stop messing with the 'g' group of options in CompilerInvocation.

With this change, most 'g' options are rejected by CompilerInvocation.
They remain only as Driver options. The new way to request debug info
from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}"
and "-dwarf-version={2|3|4}". In the absence of a command-line option
to specify Dwarf version, the Toolchain decides it, rather than placing
Toolchain-specific logic in CompilerInvocation.

Also fix a bug in the Windows compatibility argument parsing
in which the "rightmost argument wins" principle failed.

Differential Revision: http://reviews.llvm.org/D13221

Event Timeline

vsukharev added inline comments.

Unfortunately, "GetDefaultDwarfVersion()" is not gonna be called within assembler.
This way, the following test leads to crash, because Opts.DwarfVesion remains zero, that causes "llvm_unreachable()" at lib/MC/MCDwarf.cpp::getCIEVersion()
Would you please rework your patch, so that crash would not happen?

Also this test deserves to be considered to be added as a regression test, for ex, to DebugInfo/ARM/debug_info_smoketest.s
Or, maybe some more generic test to be added to other location.
Though it's more like integration test, than regression:

  • driver don't pass "-dwarf-version=4", expecting assembler to behave, and
  • assembler expects driver to pass "-dwarf-version=" explicitly, not using any defaults.
@ RUN: clang  --target=armv8a-linux-gnueabi -c %s -o %t
@ RUN: llvm-objdump -t  %t | FileCheck %s
    .type   foo,%function
foo:                                    @ @foo
    mov r0, #0
    bx  lr
    .size   foo, .Ltmp2-foo
    .cfi_sections .debug_frame
@ CHECK: foo


dougk added a comment.Oct 13 2015, 9:27 AM

thanks for the test case. Fixed by http://reviews.llvm.org/rL250173