Based on a patch by Arlo Siemsen (D98438)!
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Probably we should reject the -gsrc... option if we're emitting DWARF, which requires MD5 (at least so far).
It's a cc1 option. As those aren't considered user facing, we don't do a lot of checking for them usually.
clang/include/clang/Basic/CodeGenOptions.def | ||
---|---|---|
344 | Seems superfluous to me too, but this file is very consistent about having superfluous comments for every option. I'll add the trailing period. | |
clang/include/clang/Basic/CodeGenOptions.h | ||
106 | I'm guessing "check sum kind", but I don't know :) SHA_ looks a bit funny as prefix too... I also don't love the cc1 flag name, but I figured it's a bit bikesheddy and it's internal only so i kept it as is. If you have a preference for flag name, enum name, and enum prefix, let me know. |
clang/test/CodeGen/debug-info-file-checksum.c | ||
---|---|---|
4 | I thought -gsrc... was not a driver option, but here it is being passed to the driver? |
clang/test/CodeGen/debug-info-file-checksum.c | ||
---|---|---|
4 | Good catch, thanks. https://reviews.llvm.org/D134544#inline-1297003 does mark it as CC1Option. It's definitely meant to be a driver option, let me look into why this works here. It shouldn't. |
clang/test/CodeGen/debug-info-file-checksum.c | ||
---|---|---|
4 | Aha, I want NoDriverOption too. Update coming in a bit… |
lgtm
clang/include/clang/Basic/CodeGenOptions.h | ||
---|---|---|
106 | How about enum DebugSrcHashKind { DSH_MD5, ... ("kind" seems a common suffix for these, "debug" is a nice hint about what area this applies to.) | |
clang/lib/CodeGen/CGDebugInfo.cpp | ||
377 | Perhaps it would be simpler to drop the CSKind variable and fold the return into the individual cases? |
clang/include/clang/Driver/Options.td | ||
---|---|---|
3220 | This is a driver flag, yeah? Might be worth documenting/emitting a warning that it's not compatible with DWARF emission? (looks like the DWARF code in LLVM ignores any hash that's not MD5, because DWARF doesn't have a way to encode other hash algorithms currently - though maybe there's some extension space available to add it, I haven't checked/looked) |
clang/include/clang/Driver/Options.td | ||
---|---|---|
3220 | belated: this is Flags<[CC1Option, NoDriverOption]>, in the line below, so I think this isn't a driver flag. (It's what the CLFlags added below expand to – those are driver flags, but only for clang-cl.) |
clang/include/clang/Driver/Options.td | ||
---|---|---|
3220 | Oh, I see - I think I was confused by the driver code referencing gsrc_hash_EQ - but that's because the /ZH are implemented as aliases for gsrc_hash_EQ. I guess then maybe my comment applies to /ZH - if someone asks for DWARF and uses that flag? But maybe not worth it... |
what does CSK stand for here?