This is an archive of the discontinued LLVM Phabricator instance.

clang-format: fix fallback style set to "none" not formatting
ClosedPublic

Authored by amaiorano on Jan 17 2017, 7:46 PM.

Details

Summary

This change fixes the fact that fallback style set to "none" should not format. Without this change, fallback style "none" ends up applying LLVM formatting.

Diff Detail

Repository
rL LLVM

Event Timeline

amaiorano created this revision.Jan 17 2017, 7:46 PM
amaiorano added inline comments.Jan 17 2017, 7:52 PM
lib/Format/Format.cpp
1906 ↗(On Diff #84795)

Technically, we don't need to initialize FallbackStyle to getNoStyle() here as the call to getPredefinedStyle just below will initialize it. Let me know what you would prefer here.

test/Format/style-on-command-line.cpp
15 ↗(On Diff #84795)

Tests no config file found, WebKit fallback style is applied

16 ↗(On Diff #84795)

Tests no config file found, no fallback style, LLVM style is applied

17 ↗(On Diff #84795)

Tests no config file found, fallback style set to "none", no formatting is applied

djasper accepted this revision.Jan 17 2017, 10:35 PM
djasper added inline comments.
lib/Format/Format.cpp
1906 ↗(On Diff #84795)

This seems fine.

test/Format/style-on-command-line.cpp
15 ↗(On Diff #84795)

Please put these into comments (as long as they don't start with "RUN", they should be just left alone as normal comments.

This revision is now accepted and ready to land.Jan 17 2017, 10:35 PM
This revision was automatically updated to reflect the committed changes.