================ @@ -206,20 +191,30 @@ which can be passed directly to ‘clang-format’." ((= status 0) nil) ;; Return of 1 indicates found diffs and no error. ((= status 1) - ;; Iterate through all lines in diff buffer and collect all - ;; lines in current buffer that have a diff. - (goto-char (point-min)) - (while (not (eobp)) - (let ((diff-line (clang-format--vc-diff-match-diff-line - (buffer-substring-no-properties - (line-beginning-position) - (line-end-position))))) - (when diff-line - ;; Create list line regions with diffs to pass to - ;; clang-format. - (push (concat "--lines=" diff-line) diff-lines))) - (forward-line 1)) - (reverse diff-lines)) + ;; Find and collect all diff lines. + ;; We are matching something like: + ;; "@@ -80 +80 @@" or "@@ -80,2 +80,2 @@" + (let ((diff-lines-re + "^@@\s-[0-9,]+\s\\+\\([0-9]+\\)\\(,\\([0-9]+\\)\\)?\s@@$") + (index 0) + (all-lines + (buffer-substring-no-properties (point-min) (point-max)))) ---------------- goldsteinn wrote:
Fixed https://github.com/llvm/llvm-project/pull/112792 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits