DebugInfo: Flag Dwarf Version metadata for merging during LTO
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 23 Nov 2019 01:01:54 +0000 (17:01 -0800)
committerDavid Blaikie <dblaikie@gmail.com>
Sat, 23 Nov 2019 01:16:35 +0000 (17:16 -0800)
commite956952edec140d2475aa7c8cbe20fbdd3320634
tree0444ab4b78d429aa4fd7cffd3bbc9a5974077f79
parent019779dadfd7c98aedf0072d604ace295be6fa62
DebugInfo: Flag Dwarf Version metadata for merging during LTO

When the Dwarf Version metadata was initially added (r184276) there was
no support for Module::Max - though the comment suggested that was the
desired behavior. The original behavior was Module::Warn which would
warn and then pick whichever version came first - which is pretty
arbitrary/luck-based if the consumer has some need for one version or
the other.

Now that the functionality's been added (r303590) this change updates
the implementation to match the desired goal.

The general logic here is - if you compile /some/ of your program with a
more recent DWARF version, you must have a consumer that can handle it,
so might as well use it for /everything/.

The only place where this might fall down is if you have a need to use
an old tool (supporting only the older DWARF version) for some subset of
your program. In which case now it'll all be the higher version. That
seems pretty narrow (& the inverse could happen too - you specifically
/need/ the higher DWARF version for some extra expressivity, etc, in
some part of the program)
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGen/dwarf-version.c