[clang] [clang][Diagnostics] Highlight code snippets (PR #66514)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 26 23:17:14 PDT 2023
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm/llvm-project/pull/66514/clang at github.com>
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 63086d6aa0af9bb7fc73c670d680191ae646f7d8 7eff8c1dbf616cc88b24626e35d3f076bb1b723e -- clang/include/clang/Frontend/CodeSnippetHighlighter.h clang/lib/Frontend/CodeSnippetHighlighter.cpp clang/include/clang/Frontend/TextDiagnostic.h clang/lib/Frontend/TextDiagnostic.cpp clang/lib/Frontend/TextDiagnosticPrinter.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Frontend/CodeSnippetHighlighter.cpp b/clang/lib/Frontend/CodeSnippetHighlighter.cpp
index 6a30ccabd0f2..357c4a82ed07 100644
--- a/clang/lib/Frontend/CodeSnippetHighlighter.cpp
+++ b/clang/lib/Frontend/CodeSnippetHighlighter.cpp
@@ -17,7 +17,8 @@ static constexpr raw_ostream::Colors KeywordColor = raw_ostream::BLUE;
std::vector<StyleRange> CodeSnippetHighlighter::highlightLine(
unsigned LineNumber, const Preprocessor *PP, const LangOptions &LangOpts,
FileID FID, const SourceManager &SM) {
- std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
+ std::chrono::steady_clock::time_point begin =
+ std::chrono::steady_clock::now();
if (!PP)
return {};
@@ -138,7 +139,6 @@ std::vector<StyleRange> CodeSnippetHighlighter::highlightLine(
}
#endif
-
while (Lines.size() <= LineNumber)
Lines.push_back({});
diff --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp
index 8c08d2665725..bedfabeeb65a 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -648,7 +648,8 @@ static bool printWordWrapped(raw_ostream &OS, StringRef Str, unsigned Columns,
}
TextDiagnostic::TextDiagnostic(raw_ostream &OS, const LangOptions &LangOpts,
- DiagnosticOptions *DiagOpts, const Preprocessor *PP)
+ DiagnosticOptions *DiagOpts,
+ const Preprocessor *PP)
: DiagnosticRenderer(LangOpts, DiagOpts), OS(OS), PP(PP) {}
TextDiagnostic::~TextDiagnostic() {}
``````````
</details>
https://github.com/llvm/llvm-project/pull/66514
More information about the cfe-commits
mailing list