[PATCH] D41102: Setup clang-doc frontend framework

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 16 03:53:39 PDT 2018

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 =
        if (DirectoryStatus != OK) {
          llvm::errs() << "Unable to create documentation directories.\n";
  -     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";
        OS << Value;
  +     id++;



More information about the cfe-commits mailing list