Closed Bug 1405557 Opened 8 years ago Closed 8 years ago

clang-format not bracing single line if/for/while statements

Categories

(Developer Infrastructure :: Source Code Analysis, enhancement)

enhancement
Not set
normal

Tracking

(firefox58 affected)

RESOLVED INVALID
Tracking Status
firefox58 --- affected

People

(Reporter: n.nethercote, Assigned: andi)

Details

Attachments

(1 file)

Attached file test file
When I run `./mach clang-format -p` on the attached file it doesn't get changed. Ideally the if, while and for blocks would be braced.
Hmm, https://stackoverflow.com/questions/26111162/can-clang-format-add-braces-to-single-line-if-statements-etc suggests that clang-format can't insert braces. glandium suggested that it's designed to only change whitespace. That's disappointing.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
Mike is correct. However, we already have ways to fix that in-tree with clang-tidy.
(In reply to Sylvestre Ledru [:sylvestre] from comment #2) > Mike is correct. However, we already have ways to fix that in-tree with > clang-tidy. Is there a `mach` command, or something similar, to fix braces with clang-tidy?
Flags: needinfo?(sledru)
Yes, I have been working on this to give it to you. It should be: ./mach static-analyzer check --check google-readability-braces-around-statements --fix js/src/asmjs/ but this is blocked by bug 1405602
Flags: needinfo?(sledru)
Assignee: nobody → bpostelnicu
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: