lebedev.ri added a comment.

So what part is failing, specifically?
The SHA1 blobs of USR's differ in the llvm-bcanalyzer dumps?
The actual filenames `%t/docs/bc/<sha1-to-text>` differ?
I guess both?

First one you should be able to handle by replacing the actual values with a 
regex
(i'd guess `<USR abbrevid=4 op0=20 op1=11 <...> op19=226 op20=232/>` -> `<USR 
abbrevid=4 .*/>`, but did not try)
I'm not sure we care about the actual values here, do we?

Second one is interesting.
If we assume that the order in which those are generated is the same, which i 
think is a safer assumption,
then you could just use result id, not key (sha1-to-text of USR), i.e. 
`%t/docs/bc/00.bc`, `%t/docs/bc/01.bc` and so on.
I.e. //something// like:

    if (DumpMapperResult) {
  +   unsigned id = 0;
      Exec->get()->getToolResults()->forEachResult([&](StringRef Key,
                                                       StringRef Value) {
        SmallString<128> IRRootPath;
        llvm::sys::path::native(OutDirectory, IRRootPath);
        llvm::sys::path::append(IRRootPath, "bc");
        std::error_code DirectoryStatus =
            llvm::sys::fs::create_directories(IRRootPath);
        if (DirectoryStatus != OK) {
          llvm::errs() << "Unable to create documentation directories.\n";
          return;
        }
  -     llvm::sys::path::append(IRRootPath, Key + ".bc");
  +     llvm::sys::path::append(IRRootPath, std::to_string(id) + ".bc");
        std::error_code OutErrorInfo;
        llvm::raw_fd_ostream OS(IRRootPath, OutErrorInfo, 
llvm::sys::fs::F_None);
        if (OutErrorInfo != OK) {
          llvm::errs() << "Error opening documentation file.\n";
          return;
        }
        OS << Value;
        OS.close();
  +     id++;
      });
    }


Repository:
  rL LLVM

https://reviews.llvm.org/D41102



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

Reply via email to