[all-commits] [llvm/llvm-project] e71c53: [clang-format] Fix line lengths w/ comments in align

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Tue May 19 23:22:37 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e71c537a487cacaa00265e1acb765235943d5172
      https://github.com/llvm/llvm-project/commit/e71c537a487cacaa00265e1acb765235943d5172
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2020-05-20 (Wed, 20 May 2020)

  Changed paths:
    M clang/lib/Format/WhitespaceManager.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] Fix line lengths w/ comments in align

Summary:
https://bugs.llvm.org/show_bug.cgi?id=43845

When a '//comment' trails a consecutive alignment, it adds a whitespace
replacement within the comment token. This wasn't handled correctly in
the alignment code, which treats it as a whole token and thus double
counts it.

This can wrongly trigger the "line too long, it'll wrap" alignment-break
condition with specific lengths, causing the alignment to break for
seemingly no reason.

Patch By:  JakeMerdichAMD

Reviewed By: MyDeveloperDay

Subscribers: kostyakozko, cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79465




More information about the All-commits mailing list