[clang-tools-extra] [clang-doc] fix broken tests (PR #100260)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 23 15:48:27 PDT 2024


https://github.com/PeterChou1 created https://github.com/llvm/llvm-project/pull/100260

This patch fixes the broken test caused by clang-doc which was caused by https://github.com/llvm/llvm-project/pull/100251

https://lab.llvm.org/buildbot/#/builders/144/builds/3080

>From 72911ee0060d300a393590b47231666e66e85ad5 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Sat, 13 Jul 2024 20:27:31 -0400
Subject: [PATCH 1/5] remove USR

---
 clang-tools-extra/clang-doc/HTMLGenerator.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index f6b5e8926f903..c4df336418484 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -983,7 +983,7 @@ static llvm::Error serializeIndex(ClangDocContext &CDCtx) {
   llvm::json::OStream J(OS, 2);
   std::function<void(Index)> IndexToJSON = [&](const Index &I) {
     J.object([&] {
-      J.attribute("USR", toHex(llvm::toStringRef(I.USR)));
+      //J.attribute("USR", toHex(llvm::toStringRef(I.USR)));
       J.attribute("Name", I.Name);
       J.attribute("RefType", getRefType(I.RefType));
       J.attribute("Path", I.getRelativeFilePath(""));

>From 0175429ab5769dbba49741c543f54b7b93864372 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Mon, 15 Jul 2024 01:45:44 -0400
Subject: [PATCH 2/5] test

---
 .../clang-doc/tool/ClangDocMain.cpp           | 76 ++++++++++++-------
 1 file changed, 49 insertions(+), 27 deletions(-)

diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 6198a6e0cdcc3..08f06f8feed0f 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -45,6 +45,10 @@
 #include <atomic>
 #include <mutex>
 #include <string>
+#include <exception>
+#include <typeinfo>
+#include <stdexcept>
+
 
 using namespace clang::ast_matchers;
 using namespace clang::tooling;
@@ -205,6 +209,19 @@ llvm::Error getHtmlAssetFiles(const char *Argv0,
   return getDefaultAssetFiles(Argv0, CDCtx);
 }
 
+void handle_eptr(std::exception_ptr eptr) // passing by value is OK
+{
+  try
+  {
+    if (eptr)
+      std::rethrow_exception(eptr);
+  }
+  catch(const std::exception& e)
+  {
+    llvm::outs() << "Caught exception: '" << e.what() << "'\n";
+  }
+}
+
 int main(int argc, const char **argv) {
   llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
   std::error_code OK;
@@ -231,6 +248,7 @@ Example usage for a project using a compile commands database:
 
   // Fail early if an invalid format was provided.
   std::string Format = getFormatString();
+  llvm::outs() << "Unoptimized\n";
   llvm::outs() << "Emiting docs in " << Format << " format.\n";
   auto G = doc::findGeneratorByName(Format);
   if (!G) {
@@ -302,37 +320,41 @@ Example usage for a project using a compile commands database:
   llvm::DefaultThreadPool Pool(llvm::hardware_concurrency(ExecutorConcurrency));
   for (auto &Group : USRToBitcode) {
     Pool.async([&]() {
-      std::vector<std::unique_ptr<doc::Info>> Infos;
-
-      for (auto &Bitcode : Group.getValue()) {
-        llvm::BitstreamCursor Stream(Bitcode);
-        doc::ClangDocBitcodeReader Reader(Stream);
-        auto ReadInfos = Reader.readBitcode();
-        if (!ReadInfos) {
-          llvm::errs() << toString(ReadInfos.takeError()) << "\n";
-          Error = true;
-          return;
+      try {
+        std::vector<std::unique_ptr<doc::Info>> Infos;
+        for (auto &Bitcode : Group.getValue()) {
+          llvm::BitstreamCursor Stream(Bitcode);
+          doc::ClangDocBitcodeReader Reader(Stream);
+          auto ReadInfos = Reader.readBitcode();
+          if (!ReadInfos) {
+            llvm::errs() << toString(ReadInfos.takeError()) << "\n";
+            Error = true;
+            return;
+          }
+          std::move(ReadInfos->begin(), ReadInfos->end(),
+                    std::back_inserter(Infos));
         }
-        std::move(ReadInfos->begin(), ReadInfos->end(),
-                  std::back_inserter(Infos));
-      }
 
-      auto Reduced = doc::mergeInfos(Infos);
-      if (!Reduced) {
-        llvm::errs() << llvm::toString(Reduced.takeError());
-        return;
-      }
+        auto Reduced = doc::mergeInfos(Infos);
+        if (!Reduced) {
+          llvm::errs() << llvm::toString(Reduced.takeError());
+          return;
+        }
 
-      // Add a reference to this Info in the Index
-      {
-        std::lock_guard<llvm::sys::Mutex> Guard(IndexMutex);
-        clang::doc::Generator::addInfoToIndex(CDCtx.Idx, Reduced.get().get());
-      }
+        // Add a reference to this Info in the Index
+        {
+          std::lock_guard<llvm::sys::Mutex> Guard(IndexMutex);
+          clang::doc::Generator::addInfoToIndex(CDCtx.Idx, Reduced.get().get());
+        }
 
-      // Save in the result map (needs a lock due to threaded access).
-      {
-        std::lock_guard<llvm::sys::Mutex> Guard(USRToInfoMutex);
-        USRToInfo[Group.getKey()] = std::move(Reduced.get());
+        // Save in the result map (needs a lock due to threaded access).
+        {
+          std::lock_guard<llvm::sys::Mutex> Guard(USRToInfoMutex);
+          USRToInfo[Group.getKey()] = std::move(Reduced.get());
+        }
+      } catch (...) {
+        std::exception_ptr P = std::current_exception();
+        handle_eptr(P);
       }
     });
   }

>From 5dd3db46dbc16bdbb21913c23e650396970e966d Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 23 Jul 2024 18:25:34 -0400
Subject: [PATCH 3/5] Revert "[clang-doc] add ftime profiling (#97644)"

This reverts commit 7868c04d97b4c30b3c23f126ec206e7ece3b8b70.
this broken some builds here https://lab.llvm.org/buildbot/#/builders/145/builds/789
---
 clang-tools-extra/clang-doc/BitcodeReader.cpp |  8 ----
 clang-tools-extra/clang-doc/Mapper.cpp        | 10 ----
 .../clang-doc/Representation.cpp              |  6 +--
 clang-tools-extra/clang-doc/Representation.h  |  5 +-
 .../clang-doc/tool/ClangDocMain.cpp           | 48 ++-----------------
 5 files changed, 8 insertions(+), 69 deletions(-)

diff --git a/clang-tools-extra/clang-doc/BitcodeReader.cpp b/clang-tools-extra/clang-doc/BitcodeReader.cpp
index bb2c43ad8171e..bfb04e7407b38 100644
--- a/clang-tools-extra/clang-doc/BitcodeReader.cpp
+++ b/clang-tools-extra/clang-doc/BitcodeReader.cpp
@@ -9,7 +9,6 @@
 #include "BitcodeReader.h"
 #include "llvm/ADT/IndexedMap.h"
 #include "llvm/Support/Error.h"
-#include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include <optional>
 
@@ -671,7 +670,6 @@ llvm::Error ClangDocBitcodeReader::readRecord(unsigned ID, T I) {
 
 template <>
 llvm::Error ClangDocBitcodeReader::readRecord(unsigned ID, Reference *I) {
-  llvm::TimeTraceScope("Reducing infos", "readRecord");
   Record R;
   llvm::StringRef Blob;
   llvm::Expected<unsigned> MaybeRecID = Stream.readRecord(ID, R, &Blob);
@@ -683,7 +681,6 @@ llvm::Error ClangDocBitcodeReader::readRecord(unsigned ID, Reference *I) {
 // Read a block of records into a single info.
 template <typename T>
 llvm::Error ClangDocBitcodeReader::readBlock(unsigned ID, T I) {
-  llvm::TimeTraceScope("Reducing infos", "readBlock");
   if (llvm::Error Err = Stream.EnterSubBlock(ID))
     return Err;
 
@@ -714,7 +711,6 @@ llvm::Error ClangDocBitcodeReader::readBlock(unsigned ID, T I) {
 
 template <typename T>
 llvm::Error ClangDocBitcodeReader::readSubBlock(unsigned ID, T I) {
-  llvm::TimeTraceScope("Reducing infos", "readSubBlock");
   switch (ID) {
   // Blocks can only have certain types of sub blocks.
   case BI_COMMENT_BLOCK_ID: {
@@ -821,7 +817,6 @@ llvm::Error ClangDocBitcodeReader::readSubBlock(unsigned ID, T I) {
 
 ClangDocBitcodeReader::Cursor
 ClangDocBitcodeReader::skipUntilRecordOrBlock(unsigned &BlockOrRecordID) {
-  llvm::TimeTraceScope("Reducing infos", "skipUntilRecordOrBlock");
   BlockOrRecordID = 0;
 
   while (!Stream.AtEndOfStream()) {
@@ -883,7 +878,6 @@ llvm::Error ClangDocBitcodeReader::validateStream() {
 }
 
 llvm::Error ClangDocBitcodeReader::readBlockInfoBlock() {
-  llvm::TimeTraceScope("Reducing infos", "readBlockInfoBlock");
   Expected<std::optional<llvm::BitstreamBlockInfo>> MaybeBlockInfo =
       Stream.ReadBlockInfoBlock();
   if (!MaybeBlockInfo)
@@ -900,7 +894,6 @@ llvm::Error ClangDocBitcodeReader::readBlockInfoBlock() {
 template <typename T>
 llvm::Expected<std::unique_ptr<Info>>
 ClangDocBitcodeReader::createInfo(unsigned ID) {
-  llvm::TimeTraceScope("Reducing infos", "createInfo");
   std::unique_ptr<Info> I = std::make_unique<T>();
   if (auto Err = readBlock(ID, static_cast<T *>(I.get())))
     return std::move(Err);
@@ -909,7 +902,6 @@ ClangDocBitcodeReader::createInfo(unsigned ID) {
 
 llvm::Expected<std::unique_ptr<Info>>
 ClangDocBitcodeReader::readBlockToInfo(unsigned ID) {
-  llvm::TimeTraceScope("Reducing infos", "readBlockToInfo");
   switch (ID) {
   case BI_NAMESPACE_BLOCK_ID:
     return createInfo<NamespaceInfo>(ID);
diff --git a/clang-tools-extra/clang-doc/Mapper.cpp b/clang-tools-extra/clang-doc/Mapper.cpp
index ed12e53f49161..bb8b7952980ac 100644
--- a/clang-tools-extra/clang-doc/Mapper.cpp
+++ b/clang-tools-extra/clang-doc/Mapper.cpp
@@ -13,17 +13,12 @@
 #include "clang/Index/USRGeneration.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Error.h"
-#include "llvm/Support/TimeProfiler.h"
 
 namespace clang {
 namespace doc {
 
 void MapASTVisitor::HandleTranslationUnit(ASTContext &Context) {
-  if (CDCtx.FTimeTrace)
-    llvm::timeTraceProfilerInitialize(200, "clang-doc");
   TraverseDecl(Context.getTranslationUnitDecl());
-  if (CDCtx.FTimeTrace)
-    llvm::timeTraceProfilerFinishThread();
 }
 
 template <typename T> bool MapASTVisitor::mapDecl(const T *D) {
@@ -35,7 +30,6 @@ template <typename T> bool MapASTVisitor::mapDecl(const T *D) {
   if (D->getParentFunctionOrMethod())
     return true;
 
-  llvm::timeTraceProfilerBegin("Mapping declaration", "emit info from astnode");
   llvm::SmallString<128> USR;
   // If there is an error generating a USR for the decl, skip this decl.
   if (index::generateUSRForDecl(D, USR))
@@ -46,10 +40,7 @@ template <typename T> bool MapASTVisitor::mapDecl(const T *D) {
   auto I = serialize::emitInfo(D, getComment(D, D->getASTContext()),
                                getLine(D, D->getASTContext()), File,
                                IsFileInRootDir, CDCtx.PublicOnly);
-  llvm::timeTraceProfilerEnd();
 
-  llvm::timeTraceProfilerBegin("Mapping declaration",
-                               "serialized info into bitcode");
   // A null in place of I indicates that the serializer is skipping this decl
   // for some reason (e.g. we're only reporting public decls).
   if (I.first)
@@ -58,7 +49,6 @@ template <typename T> bool MapASTVisitor::mapDecl(const T *D) {
   if (I.second)
     CDCtx.ECtx->reportResult(llvm::toHex(llvm::toStringRef(I.second->USR)),
                              serialize::serialize(I.second));
-  llvm::timeTraceProfilerEnd();
   return true;
 }
 
diff --git a/clang-tools-extra/clang-doc/Representation.cpp b/clang-tools-extra/clang-doc/Representation.cpp
index 64abacac37112..d08afbb962189 100644
--- a/clang-tools-extra/clang-doc/Representation.cpp
+++ b/clang-tools-extra/clang-doc/Representation.cpp
@@ -368,11 +368,9 @@ ClangDocContext::ClangDocContext(tooling::ExecutionContext *ECtx,
                                  StringRef ProjectName, bool PublicOnly,
                                  StringRef OutDirectory, StringRef SourceRoot,
                                  StringRef RepositoryUrl,
-                                 std::vector<std::string> UserStylesheets,
-                                 bool FTimeTrace)
+                                 std::vector<std::string> UserStylesheets)
     : ECtx(ECtx), ProjectName(ProjectName), PublicOnly(PublicOnly),
-      OutDirectory(OutDirectory), UserStylesheets(UserStylesheets),
-      FTimeTrace(FTimeTrace) {
+      OutDirectory(OutDirectory), UserStylesheets(UserStylesheets) {
   llvm::SmallString<128> SourceRootDir(SourceRoot);
   if (SourceRoot.empty())
     // If no SourceRoot was provided the current path is used as the default
diff --git a/clang-tools-extra/clang-doc/Representation.h b/clang-tools-extra/clang-doc/Representation.h
index 7de154d642c8b..d70c279f7a2bd 100644
--- a/clang-tools-extra/clang-doc/Representation.h
+++ b/clang-tools-extra/clang-doc/Representation.h
@@ -482,13 +482,10 @@ struct ClangDocContext {
   ClangDocContext(tooling::ExecutionContext *ECtx, StringRef ProjectName,
                   bool PublicOnly, StringRef OutDirectory, StringRef SourceRoot,
                   StringRef RepositoryUrl,
-                  std::vector<std::string> UserStylesheets,
-                  bool FTimeTrace = false);
+                  std::vector<std::string> UserStylesheets);
   tooling::ExecutionContext *ECtx;
   std::string ProjectName; // Name of project clang-doc is documenting.
   bool PublicOnly; // Indicates if only public declarations are documented.
-  bool FTimeTrace; // Indicates if ftime trace is turned on
-  int Granularity; // Granularity of ftime trace
   std::string OutDirectory; // Directory for outputting generated files.
   std::string SourceRoot;   // Directory where processed files are stored. Links
                             // to definition locations will only be generated if
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 97648af7cf8fd..6198a6e0cdcc3 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -41,7 +41,6 @@
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/ThreadPool.h"
-#include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include <atomic>
 #include <mutex>
@@ -100,11 +99,6 @@ URL of repository that hosts code.
 Used for links to definition locations.)"),
                   llvm::cl::cat(ClangDocCategory));
 
-static llvm::cl::opt<bool> FTimeTrace("ftime-trace", llvm::cl::desc(R"(
-Turn on time profiler. Generates clang-doc-tracing.json)"),
-                                      llvm::cl::init(false),
-                                      llvm::cl::cat(ClangDocCategory));
-
 enum OutputFormatTy {
   md,
   yaml,
@@ -235,12 +229,6 @@ Example usage for a project using a compile commands database:
     return 1;
   }
 
-  // turns on ftime trace profiling
-  if (FTimeTrace)
-    llvm::timeTraceProfilerInitialize(200, "clang-doc");
-
-  llvm::TimeTraceScope("main");
-
   // Fail early if an invalid format was provided.
   std::string Format = getFormatString();
   llvm::outs() << "Emiting docs in " << Format << " format.\n";
@@ -264,8 +252,8 @@ Example usage for a project using a compile commands database:
       OutDirectory,
       SourceRoot,
       RepositoryUrl,
-      {UserStylesheets.begin(), UserStylesheets.end()},
-      FTimeTrace};
+      {UserStylesheets.begin(), UserStylesheets.end()}
+  };
 
   if (Format == "html") {
     if (auto Err = getHtmlAssetFiles(argv[0], CDCtx)) {
@@ -274,7 +262,6 @@ Example usage for a project using a compile commands database:
     }
   }
 
-  llvm::timeTraceProfilerBegin("Mapping declaration", "total runtime");
   // Mapping phase
   llvm::outs() << "Mapping decls...\n";
   auto Err =
@@ -289,12 +276,10 @@ Example usage for a project using a compile commands database:
       return 1;
     }
   }
-  llvm::timeTraceProfilerEnd();
 
   // Collect values into output by key.
   // In ToolResults, the Key is the hashed USR and the value is the
   // bitcode-encoded representation of the Info object.
-  llvm::timeTraceProfilerBegin("Collect Info", "total runtime");
   llvm::outs() << "Collecting infos...\n";
   llvm::StringMap<std::vector<StringRef>> USRToBitcode;
   Executor->get()->getToolResults()->forEachResult(
@@ -302,7 +287,6 @@ Example usage for a project using a compile commands database:
         auto R = USRToBitcode.try_emplace(Key, std::vector<StringRef>());
         R.first->second.emplace_back(Value);
       });
-  llvm::timeTraceProfilerEnd();
 
   // Collects all Infos according to their unique USR value. This map is added
   // to from the thread pool below and is protected by the USRToInfoMutex.
@@ -310,7 +294,6 @@ Example usage for a project using a compile commands database:
   llvm::StringMap<std::unique_ptr<doc::Info>> USRToInfo;
 
   // First reducing phase (reduce all decls into one info per decl).
-  llvm::timeTraceProfilerBegin("Reducing infos", "total runtime");
   llvm::outs() << "Reducing " << USRToBitcode.size() << " infos...\n";
   std::atomic<bool> Error;
   Error = false;
@@ -319,11 +302,8 @@ Example usage for a project using a compile commands database:
   llvm::DefaultThreadPool Pool(llvm::hardware_concurrency(ExecutorConcurrency));
   for (auto &Group : USRToBitcode) {
     Pool.async([&]() {
-      if (FTimeTrace)
-        llvm::timeTraceProfilerInitialize(200, "clang-doc");
-
-      llvm::timeTraceProfilerBegin("Reducing infos", "decoding bitcode");
       std::vector<std::unique_ptr<doc::Info>> Infos;
+
       for (auto &Bitcode : Group.getValue()) {
         llvm::BitstreamCursor Stream(Bitcode);
         doc::ClangDocBitcodeReader Reader(Stream);
@@ -336,40 +316,32 @@ Example usage for a project using a compile commands database:
         std::move(ReadInfos->begin(), ReadInfos->end(),
                   std::back_inserter(Infos));
       }
-      llvm::timeTraceProfilerEnd();
 
-      llvm::timeTraceProfilerBegin("Reducing infos", "merging bitcode");
       auto Reduced = doc::mergeInfos(Infos);
       if (!Reduced) {
         llvm::errs() << llvm::toString(Reduced.takeError());
         return;
       }
-      llvm::timeTraceProfilerEnd();
 
       // Add a reference to this Info in the Index
       {
         std::lock_guard<llvm::sys::Mutex> Guard(IndexMutex);
         clang::doc::Generator::addInfoToIndex(CDCtx.Idx, Reduced.get().get());
       }
-      // Save in the result map (needs a lock due to threaded access).
 
+      // Save in the result map (needs a lock due to threaded access).
       {
         std::lock_guard<llvm::sys::Mutex> Guard(USRToInfoMutex);
         USRToInfo[Group.getKey()] = std::move(Reduced.get());
       }
-
-      if (CDCtx.FTimeTrace)
-        llvm::timeTraceProfilerFinishThread();
     });
   }
-  llvm::timeTraceProfilerEnd();
 
   Pool.wait();
 
   if (Error)
     return 1;
 
-  llvm::timeTraceProfilerBegin("Writing output", "total runtime");
   // Ensure the root output directory exists.
   if (std::error_code Err = llvm::sys::fs::create_directories(OutDirectory);
       Err != std::error_code()) {
@@ -390,16 +362,6 @@ Example usage for a project using a compile commands database:
   if (Err) {
     llvm::outs() << "warning: " << toString(std::move(Err)) << "\n";
   }
-  llvm::timeTraceProfilerEnd();
-
-  if (FTimeTrace) {
-    std::error_code EC;
-    llvm::raw_fd_ostream OS("clang-doc-tracing.json", EC,
-                            llvm::sys::fs::OF_Text);
-    if (!EC)
-      llvm::timeTraceProfilerWrite(OS);
-    else
-      return 1;
-  }
+
   return 0;
 }

>From 3d9b03d145ebf1607dfca4e87f0c405623bec9cc Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 23 Jul 2024 18:42:53 -0400
Subject: [PATCH 4/5] [clang-doc] uncomment USR

---
 clang-tools-extra/clang-doc/HTMLGenerator.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index c4df336418484..f6b5e8926f903 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -983,7 +983,7 @@ static llvm::Error serializeIndex(ClangDocContext &CDCtx) {
   llvm::json::OStream J(OS, 2);
   std::function<void(Index)> IndexToJSON = [&](const Index &I) {
     J.object([&] {
-      //J.attribute("USR", toHex(llvm::toStringRef(I.USR)));
+      J.attribute("USR", toHex(llvm::toStringRef(I.USR)));
       J.attribute("Name", I.Name);
       J.attribute("RefType", getRefType(I.RefType));
       J.attribute("Path", I.getRelativeFilePath(""));

>From ef6ed71b52ae5adedf2a03de00eb8c5e73362edb Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 23 Jul 2024 18:45:20 -0400
Subject: [PATCH 5/5] [clang-doc] fix broken build due to broken USR test

---
 clang-tools-extra/clang-doc/HTMLGenerator.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index c4df336418484..f6b5e8926f903 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -983,7 +983,7 @@ static llvm::Error serializeIndex(ClangDocContext &CDCtx) {
   llvm::json::OStream J(OS, 2);
   std::function<void(Index)> IndexToJSON = [&](const Index &I) {
     J.object([&] {
-      //J.attribute("USR", toHex(llvm::toStringRef(I.USR)));
+      J.attribute("USR", toHex(llvm::toStringRef(I.USR)));
       J.attribute("Name", I.Name);
       J.attribute("RefType", getRefType(I.RefType));
       J.attribute("Path", I.getRelativeFilePath(""));



More information about the cfe-commits mailing list