Printing out the file being currently compiled (feature request)

Please let me know if I need to move this to cfe-users or cfe-dev - it's a simple request when running Clang inside Visual Studio. Here's the kind of thing I typically see during a Clang build:-

Build started...
1>------ Build started: Project: zita-resampler, Configuration: Release x64 ------
1>In file included from <built-in>:1:
1>In file included from F:\+GTK-SOURCES\gnu-windows\include\ardourext\sys\targetsxs.h:100:
1>F:\+GTK-SOURCES\gnu-windows\include\gtkmmconfig.h(21,37): warning : '/*' within block comment [-Wcomment]
1>In file included from <built-in>:1:
1>In file included from F:\+GTK-SOURCES\gnu-windows\include\ardourext\sys\targetsxs.h:100:
1>F:\+GTK-SOURCES\gnu-windows\include\gtkmmconfig.h(21,37): warning : '/*' within block comment [-Wcomment]
1>../zita-resampler/vresampler.h(79,23): warning : private field '_dummy' is not used [-Wunused-private-field]

I can see various warnings but what I can't tell is which file was being compiled at the time. Microsoft's own output looks more like this:-

Rebuild started...
1>------ Rebuild All started: Project: zita-resampler, Configuration: Release x64 ------
1>cresampler.cc
1>F:\+GTK-SOURCES\Ardour\libs\zita-resampler\cresampler.cc(135,10): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1>resampler-table.cc
1>resampler.cc
1>vmresampler.cc
1>vresampler.cc

Microsoft's warnings are different but the important thing is that I can see which file was getting compiled when the warning occurred. Is there any way that Clang could be adapted to print out which file it's compiling? When building a big project it's also useful for having a rough estimate of how many sources are left to be compiled.

Thanks, John

Hi John,

clang-cl has a /showFilenames option which will make it print the
filename. Does that work for you?

Thanks,
Hans

Ah, that seems to work Hans - many thanks!

John

A dumb question maybe - but does Clang have some kind of config file that I could add this to? i.e. a "one time" change, rather than needing to add it to hundreds of VS projects here?

John

Clang does have a config file concept, see [1], but I don't think it
would help here since you would need the --config option to use them.

It's also possible to pass flags via environment variables, but again
I don't think that would make it easier since you'd still need to
update the project file.

- Hans

[1] Clang Compiler User’s Manual — Clang 16.0.0git documentation

Well environment variables could also be set in the environment, i.e.
system- or user-global

Thanks Mara - could you give me an example of what I'd need to set?

John

clang-cl will pick up command-line options from the CL and _CL_
environment variables similarly to MSVC (see
CL environment variables | Microsoft Docs)

But if you set CL=/showFilenames and then use MSVC instead of
clang-cl, it will warn about the unknown flag. So it's not a perfect
solution.

- Hans