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

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

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

Tests no config file found, WebKit fallback style is applied

16

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

17

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

This seems fine.

test/Format/style-on-command-line.cpp
15

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.