[PATCH] D27641: DebugInfo: Added support for Checksum debug info feature (Clang part)
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 12 09:21:33 PST 2016
rnk added inline comments.
================
Comment at: lib/Basic/SourceManager.cpp:1447
+void SourceManager::getChecksumMD5(FileID FID, std::string &Checksum) const {
+ bool Invalid;
----------------
Let's move this whole thing to CGDebugInfo::getOrCreateFile. SourceManager isn't caching or managing MD5 checksums at all in this CL.
================
Comment at: lib/Basic/SourceManager.cpp:1450-1451
+
+ llvm::MemoryBuffer *MemBuffer = getBuffer(FID, &Invalid);
+ if (Invalid) return;
+
----------------
If this can fail, we should not pretend to have an MD5 checksum in the debug info.
================
Comment at: lib/Basic/SourceManager.cpp:1461
+
+ for (unsigned i = 0; i < sizeof(Result); i++)
+ OS << llvm::format("%02x", Result[i]);
----------------
This can use SmallString and stringifyResult() to avoid heap allocations.
================
Comment at: lib/CodeGen/CGDebugInfo.cpp:350
+ std::string Checksum;
+ SM.getChecksumMD5(SM.getFileID(Loc), Checksum);
+
----------------
We should only do this if `CGM.getCodeGenOpts().EmitCodeView`, or we will regress compile time on other platforms without any added functionality.
https://reviews.llvm.org/D27641
More information about the cfe-commits
mailing list