diff options
author | Daniel Jasper <djasper@google.com> | 2013-08-27 14:24:43 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-08-27 14:24:43 +0000 |
commit | 4c6e00595b444b958bf11a68cceed9d43dbacbc4 (patch) | |
tree | 170afc94af26e9920953fc9377badec9e75d4db5 /clang/lib/Format/TokenAnnotator.cpp | |
parent | 5320c2b563d9b6e40c24753325d448d3be6d14b6 (diff) | |
download | bcm5719-llvm-4c6e00595b444b958bf11a68cceed9d43dbacbc4.tar.gz bcm5719-llvm-4c6e00595b444b958bf11a68cceed9d43dbacbc4.zip |
clang-format: Format segments of builder-type calls one per line.
This fixes llvm.org/PR14818.
Before:
return llvm::StringSwitch<Reference::Kind>(name)
.StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
.StartsWith(".eh_frame", ORDER_EH_FRAME)
.StartsWith(".init", ORDER_INIT).StartsWith(".fini", ORDER_FINI)
.StartsWith(".hash", ORDER_HASH).Default(ORDER_TEXT);
After:
return llvm::StringSwitch<Reference::Kind>(name)
.StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
.StartsWith(".eh_frame", ORDER_EH_FRAME)
.StartsWith(".init", ORDER_INIT)
.StartsWith(".fini", ORDER_FINI)
.StartsWith(".hash", ORDER_HASH)
.Default(ORDER_TEXT);
llvm-svn: 189353
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index c8dfb13d78a..7f298555079 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1100,10 +1100,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, Left.Type == TT_InheritanceColon) return 2; - if (Right.isOneOf(tok::arrow, tok::period) && - Right.Type != TT_DesignatedInitializerPeriod) { - if (Left.isOneOf(tok::r_paren, tok::r_square) && Left.MatchingParen && - Left.MatchingParen->ParameterCount > 0) + if (Right.isMemberAccess()) { + if (Left.isOneOf(tok::r_paren, tok::r_square)) return 20; // Should be smaller than breaking at a nested comma. return 150; } |