[llvm] [FileCheck] Add split view diff option for FileCheck (PR #189269)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 18 00:56:53 PDT 2026
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 origin/main HEAD --extensions cpp,h -- llvm/include/llvm/FileCheck/FileCheck.h llvm/lib/FileCheck/FileCheck.cpp llvm/utils/FileCheck/FileCheck.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp
index 9e57f3efb..dfa5235c5 100644
--- a/llvm/lib/FileCheck/FileCheck.cpp
+++ b/llvm/lib/FileCheck/FileCheck.cpp
@@ -2785,9 +2785,9 @@ static std::string getCenteredView(StringRef S, size_t DiffPos, size_t Width) {
}
// Renders a diagnostic diff via llvm::errs().
-static void renderDiff(DiffFormatType Mode, unsigned ExpectedLineNo, unsigned ActualLineNo,
- StringRef ExpectedLine, StringRef ActualLine,
- const DiffContext &Ctx) {
+static void renderDiff(DiffFormatType Mode, unsigned ExpectedLineNo,
+ unsigned ActualLineNo, StringRef ExpectedLine,
+ StringRef ActualLine, const DiffContext &Ctx) {
auto &OS = errs();
constexpr unsigned ColWidth = 45;
constexpr StringRef Sep = " | ";
@@ -2858,8 +2858,9 @@ static void renderDiff(DiffFormatType Mode, unsigned ExpectedLineNo, unsigned Ac
}
}
-static bool printDiff(DiffFormatType Mode, const FileCheckString &CheckStr, StringRef ActualLine,
- SourceMgr &SM, std::vector<FileCheckDiag> *Diags,
+static bool printDiff(DiffFormatType Mode, const FileCheckString &CheckStr,
+ StringRef ActualLine, SourceMgr &SM,
+ std::vector<FileCheckDiag> *Diags,
unsigned OverwriteActualLine = 0) {
SMLoc PatternLoc = CheckStr.Pat.getLoc();
unsigned ExpectedLineNo = SM.getLineAndColumn(PatternLoc).first;
@@ -2886,7 +2887,8 @@ static bool printDiff(DiffFormatType Mode, const FileCheckString &CheckStr, Stri
unsigned BufID = SM.FindBufferContainingLoc(InputLoc);
DiffContext Context = getDiffContext(SM, ActualLineNo, BufID);
- renderDiff(Mode, ExpectedLineNo, ActualLineNo, ExpectedLine, ActualLine, Context);
+ renderDiff(Mode, ExpectedLineNo, ActualLineNo, ExpectedLine, ActualLine,
+ Context);
errs() << '\n';
return true;
@@ -3007,8 +3009,8 @@ bool FileCheck::checkInput(SourceMgr &SM, StringRef Buffer,
// Handle failure
if (MatchPos == StringRef::npos) {
if (IsDiffFormat) {
- handleDiffFailure(CheckStr, CheckRegion, SM, Req, Diags, OS, HeaderPrinted,
- TotalMismatches);
+ handleDiffFailure(CheckStr, CheckRegion, SM, Req, Diags, OS,
+ HeaderPrinted, TotalMismatches);
}
ChecksFailed = true;
i = j;
``````````
</details>
https://github.com/llvm/llvm-project/pull/189269
More information about the llvm-commits
mailing list