[clang-tools-extra] [clang-doc] add ftime profiling (PR #97644)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 3 14:45:47 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 10c894cffd0f4bef21b54a43b5780240532e44cf 7462b374a1ec05f84c84ea705fdc98a9d3c02783 -- clang-tools-extra/clang-doc/BitcodeReader.cpp clang-tools-extra/clang-doc/Mapper.cpp clang-tools-extra/clang-doc/Representation.cpp clang-tools-extra/clang-doc/Representation.h clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-doc/BitcodeReader.cpp b/clang-tools-extra/clang-doc/BitcodeReader.cpp
index 2fa228dd7b..eef8c1b6e7 100644
--- a/clang-tools-extra/clang-doc/BitcodeReader.cpp
+++ b/clang-tools-extra/clang-doc/BitcodeReader.cpp
@@ -9,8 +9,8 @@
#include "BitcodeReader.h"
#include "llvm/ADT/IndexedMap.h"
#include "llvm/Support/Error.h"
-#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/TimeProfiler.h"
+#include "llvm/Support/raw_ostream.h"
#include <optional>
namespace clang {
diff --git a/clang-tools-extra/clang-doc/Mapper.cpp b/clang-tools-extra/clang-doc/Mapper.cpp
index d56546dbfa..4a9e8721c9 100644
--- a/clang-tools-extra/clang-doc/Mapper.cpp
+++ b/clang-tools-extra/clang-doc/Mapper.cpp
@@ -65,9 +65,7 @@ bool MapASTVisitor::VisitNamespaceDecl(const NamespaceDecl *D) {
return mapDecl(D);
}
-bool MapASTVisitor::VisitRecordDecl(const RecordDecl *D) {
- return mapDecl(D);
-}
+bool MapASTVisitor::VisitRecordDecl(const RecordDecl *D) { return mapDecl(D); }
bool MapASTVisitor::VisitEnumDecl(const EnumDecl *D) { return mapDecl(D); }
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 4cd4a84562..c15323d614 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -41,8 +41,8 @@
#include "llvm/Support/Process.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/ThreadPool.h"
-#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/TimeProfiler.h"
+#include "llvm/Support/raw_ostream.h"
#include <atomic>
#include <mutex>
#include <string>
@@ -100,15 +100,15 @@ 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"(
+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));
+ llvm::cl::init(false),
+ llvm::cl::cat(ClangDocCategory));
-static llvm::cl::opt<int> FTimeGranularity(
- "ftime-gran", llvm::cl::desc(R"(
+static llvm::cl::opt<int> FTimeGranularity("ftime-gran", llvm::cl::desc(R"(
Specify granularity for ftime-trace defaults to 200)"),
- llvm::cl::init(200), llvm::cl::cat(ClangDocCategory));
+ llvm::cl::init(200),
+ llvm::cl::cat(ClangDocCategory));
enum OutputFormatTy {
md,
@@ -271,8 +271,7 @@ Example usage for a project using a compile commands database:
OutDirectory,
SourceRoot,
RepositoryUrl,
- {UserStylesheets.begin(), UserStylesheets.end()}
- };
+ {UserStylesheets.begin(), UserStylesheets.end()}};
if (Format == "html") {
if (auto Err = getHtmlAssetFiles(argv[0], CDCtx)) {
@@ -353,7 +352,6 @@ Example usage for a project using a compile commands database:
}
llvm::timeTraceProfilerEnd();
-
// Add a reference to this Info in the Index
{
std::lock_guard<llvm::sys::Mutex> Guard(IndexMutex);
@@ -368,7 +366,6 @@ Example usage for a project using a compile commands database:
if (CDCtx.FTimeTrace)
llvm::timeTraceProfilerFinishThread();
-
});
}
llvm::timeTraceProfilerEnd();
@@ -403,7 +400,8 @@ Example usage for a project using a compile commands database:
if (FTimeTrace) {
std::error_code EC;
- llvm::raw_fd_ostream OS("clang-doc-tracing.json", EC, llvm::sys::fs::OF_Text);
+ llvm::raw_fd_ostream OS("clang-doc-tracing.json", EC,
+ llvm::sys::fs::OF_Text);
if (!EC) {
llvm::timeTraceProfilerWrite(OS);
} else {
``````````
</details>
https://github.com/llvm/llvm-project/pull/97644
More information about the cfe-commits
mailing list