[llvm] [FileCheck] Add split view diff option for FileCheck (PR #189269)

Henrik G. Olsson via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 09:55:45 PDT 2026


================
@@ -2762,11 +2762,45 @@ static DiffContext getDiffContext(SourceMgr &SM, unsigned LineNo,
           getLineText(LineNo + 1)};
 }
 
+// Extracts a fixed-width "window" from string S, centered around DiffPos.
+static std::string getCenteredView(StringRef S, size_t DiffPos, size_t Width) {
+  if (S.size() <= Width)
+    return S.str() + std::string(Width - S.size(), ' ');
----------------
hnrklssn wrote:

nit: you can use llvm::left_justify for this

https://github.com/llvm/llvm-project/pull/189269


More information about the llvm-commits mailing list