[all-commits] [llvm/llvm-project] 7f7043: [Format] Add format check for throwing negative nu...

Brian Gesiak via All-commits all-commits at lists.llvm.org
Fri Oct 18 09:57:52 PDT 2019

  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7f704320b058f7217847ee0e599f64e2ce50447c
  Author: Brian Gesiak <modocache at gmail.com>
  Date:   2019-10-18 (Fri, 18 Oct 2019)

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

  Log Message:
  [Format] Add format check for throwing negative numbers

The code `throw -1;` is currently formatted by clang-format as
`throw - 1;`. This diff adds a fix for this edge case and a test to check
for this in the future.

For context, I am looking into a related bug in the clang-formatting of
coroutine keywords: `co_yield -1;` is also reformatted in this manner
as `co_yield - 1;`. A later diff will add these changes and tests for the
`co_yield` and `co_return` keywords.

Patch by Jonathan Thomas (jonathoma)!

Reviewers: modocache, sammccall, Quuxplusone

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

llvm-svn: 375258

More information about the All-commits mailing list