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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to