clang-cl: Add /showFilenames option (PR31957)


clang-cl: Add /showFilenames option (PR31957)

Add a /showFilenames option for users who want clang to echo the
currently compiled filename. MSVC does this echoing by default, and it's
useful for showing progress in build systems that doesn't otherwise
provide any progress report, such as MSBuild.

Differential Revision: https://reviews.llvm.org/D52773


Event Timeline

This test is failing on the powerpc bots as well as hexagon and s390x:

The failure (at least on ppowerpc64le) is due to invalid llvm.linker.options:

 /home/sfertile/llvm_build/Trunk/bin/clang --driver-mode=cl /c /showFilenames -- /home/sfertile/llvm_ca/llvm/tools/clang/test/Driver/cl-showfilenames.c /home/sfertile/llvm_ca/llvm/tools/clang/test/Driver/Inputs/wildcard2.c 
/home/sfertile/llvm_ca/llvm/tools/clang/test/Driver/cl-showfilenames.c(8,9):  warning: Hello [-W#pragma-messages]
#pragma message "Hello"
fatal error: error in backend: invalid llvm.linker.options
clang-7: error: clang frontend command failed with exit code 70 (use -v to see invocation)

Should this test only be run on platforms with valid windows targets? Or perhaps limited to non-elf targets?

I've reverted this for now.

The problem is that the windows style linker option metadata isn't valid on ELF targets. In the IR produced for the test is linker options with the following fromat:

!llvm.linker.options = !{!0, !1}
!0 = !{!"-llibcmt"}
!1 = !{!"-loldnames"}

But for ELF object files all the linker option MDNodes are expected to have 2 operands.

hans added a comment.Oct 11 2018, 12:25 PM

Sorry for the breakage.

I'm not currently at my workstation, but if you can make the test require a valid Windows target, or revert it in the meantime, that sounds good.