[PATCH] D43043: [DebugInfo] Unify ChecksumKind and Checksum value in DIFile

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 09:23:36 PST 2018


scott.linder marked an inline comment as done.
scott.linder added inline comments.


================
Comment at: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:177
+      switch (F->getChecksum()->Kind) {
+      case DIFile::CSK_MD5:  CSKind = FileChecksumKind::MD5; break;
+      case DIFile::CSK_SHA1: CSKind = FileChecksumKind::SHA1; break;
----------------
JDevlieghere wrote:
> Why do we have/need two enums to express the same thing? Are the values different?
The CodeView enum was already defined, but the previous code simply cast the `DIFile::ChecksumKind` to `unsigned` here, as the values happen to line up. This is somewhat fragile, and will only work for one format (why align the `DIFile` encoding with the CodeView encoding? why not DWARF?). I think being explicit is better here, and so when I had to make a change anyway I added the switch.


https://reviews.llvm.org/D43043





More information about the llvm-commits mailing list