#
2739af3b |
| 28-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve token breaking behavior.
Two changes: * Don't add an extra penalty on breaking the same token multiple times. Generally, we should prefer not to break, but once we break, the
clang-format: Improve token breaking behavior.
Two changes: * Don't add an extra penalty on breaking the same token multiple times. Generally, we should prefer not to break, but once we break, the normal line breaking penalties apply. * Slightly increase the penalty for breaking comments. In general, the author has put some thought into how to break the comment and we should not overwrite this unnecessarily.
With a 40-column column limit, formatting aaaaaa("aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa");
Leads to: Before: aaaaaa( "aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaa");
After: aaaaaa("aaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaaa");
llvm-svn: 189466
show more ...
|
#
96df37a6 |
| 28-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix segfault in 'incomplete' macros.
The code leading to a segfault was: #pragma omp threadprivate(y)), // long comment leading to a line break
This fixes llvm.org/PR16513.
llvm-sv
clang-format: Fix segfault in 'incomplete' macros.
The code leading to a segfault was: #pragma omp threadprivate(y)), // long comment leading to a line break
This fixes llvm.org/PR16513.
llvm-svn: 189460
show more ...
|
#
a49393f5 |
| 28-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix infinite loop in macro special case.
If escaped newlines are aligned right (FormatStyle.AlignEscapedNewlinesLeft == false), and a line contained too many characters to fit into the
clang-format: Fix infinite loop in macro special case.
If escaped newlines are aligned right (FormatStyle.AlignEscapedNewlinesLeft == false), and a line contained too many characters to fit into the column limit, this would result in a (virtually) endless loop creating a negative number of spaces.
Instead, allow the escaped newlines to be pushed past the column limit in this case.
This fixes llvm.org/PR16515.
llvm-svn: 189459
show more ...
|
#
ed8f1c6d |
| 28-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Don't insert space in __has_include
Before: #if __has_include( <strstream>) #include <strstream> #endif
After: #if __has_include(<strstream>) #include <strstream> #endif
clang-format: Don't insert space in __has_include
Before: #if __has_include( <strstream>) #include <strstream> #endif
After: #if __has_include(<strstream>) #include <strstream> #endif
This fixes llvm.org/PR16516.
llvm-svn: 189455
show more ...
|
#
a15da306 |
| 28-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix corner case in ObjC interface definitions.
In @implementation ObjcClass - (void)method; { } @end the ObjC compiler seems to accept the superfluous comma after "method", b
clang-format: Fix corner case in ObjC interface definitions.
In @implementation ObjcClass - (void)method; { } @end the ObjC compiler seems to accept the superfluous comma after "method", but clang-format used to assert on the subsequent "{".
This fixes llvm.org/PR16604.
llvm-svn: 189453
show more ...
|
#
65b79829 |
| 28-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve braced init list detection:
Before: std::this_thread::sleep_for(std::chrono::nanoseconds{ std::chrono::seconds { 1 } } / 5);
After: std
clang-format: Improve braced init list detection:
Before: std::this_thread::sleep_for(std::chrono::nanoseconds{ std::chrono::seconds { 1 } } / 5);
After: std::this_thread::sleep_for( std::chrono::nanoseconds{ std::chrono::seconds{ 1 } } / 5);
This fixes llvm.org/PR16554.
llvm-svn: 189451
show more ...
|
#
d215b8bd |
| 28-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix corner case in overloaded operator definitions.
Before: SomeLoooooooooooooooooooooooooogType operator> >(const SomeLooooooooooooooooooooooooogType &other); SomeLooooooooo
clang-format: Fix corner case in overloaded operator definitions.
Before: SomeLoooooooooooooooooooooooooogType operator> >(const SomeLooooooooooooooooooooooooogType &other); SomeLoooooooooooooooooooooooooogType // break operator>>(const SomeLooooooooooooooooooooooooogType &other);
After: SomeLoooooooooooooooooooooooooogType operator>>(const SomeLooooooooooooooooooooooooogType &other); SomeLoooooooooooooooooooooooooogType // break operator>>(const SomeLooooooooooooooooooooooooogType &other);
This fixes llvm.org/PR16328.
llvm-svn: 189450
show more ...
|
#
11be8ac5 |
| 28-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix space in decltype-constexprs.
Before: static constexpr bool Bar = decltype(bar()) ::value;
After: static constexpr bool Bar = decltype(bar())::value;
llvm-svn: 189449
|
#
4c6e0059 |
| 27-Aug-2013 |
Daniel Jasper <djasper@google.com> |
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", O
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
show more ...
|
#
b27c4b7c |
| 27-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Revamp builder-type call formatting.
Previously builder-type calls were only correctly recognized in top-level calls.
This fixes llvm.org/PR16981. Before: someobj->Add((new util::fi
clang-format: Revamp builder-type call formatting.
Previously builder-type calls were only correctly recognized in top-level calls.
This fixes llvm.org/PR16981. Before: someobj->Add((new util::filetools::Handler(dir))->OnEvent1( NewPermanentCallback(this, &HandlerHolderClass::EventHandlerCBA)) ->OnEvent2(NewPermanentCallback( this, &HandlerHolderClass::EventHandlerCBB)) ->OnEvent3(NewPermanentCallback( this, &HandlerHolderClass::EventHandlerCBC)) ->OnEvent5(NewPermanentCallback( this, &HandlerHolderClass::EventHandlerCBD)) ->OnEvent6(NewPermanentCallback( this, &HandlerHolderClass::EventHandlerCBE)));
After: someobj->Add((new util::filetools::Handler(dir)) ->OnEvent1(NewPermanentCallback( this, &HandlerHolderClass::EventHandlerCBA)) ->OnEvent2(NewPermanentCallback( this, &HandlerHolderClass::EventHandlerCBB)) ->OnEvent3(NewPermanentCallback( this, &HandlerHolderClass::EventHandlerCBC)) ->OnEvent5(NewPermanentCallback( this, &HandlerHolderClass::EventHandlerCBD)) ->OnEvent6(NewPermanentCallback( this, &HandlerHolderClass::EventHandlerCBE)));
llvm-svn: 189337
show more ...
|
#
cb3f0ed8 |
| 27-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix bug in column layout.
Before (with 60 character limit in Google style): return { {aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaa
clang-format: Fix bug in column layout.
Before (with 60 character limit in Google style): return { {aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa}}; After: return {{aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa}};
llvm-svn: 189327
show more ...
|
#
8863ada8 |
| 26-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix bug in column-layout formatting.
Specific arrangements of comments after trailing commas could confuse the column width calculation, e.g. in:
vector<int> x = { a, b,
clang-format: Fix bug in column-layout formatting.
Specific arrangements of comments after trailing commas could confuse the column width calculation, e.g. in:
vector<int> x = { a, b, /* some */ /* comment */ };
llvm-svn: 189211
show more ...
|
#
0649d361 |
| 23-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix indentation relative to unary expressions.
This should be done, only if we are still in the unary expression's scope.
Before: bool aaaa = !aaaaaaaa( // break
clang-format: Fix indentation relative to unary expressions.
This should be done, only if we are still in the unary expression's scope.
Before: bool aaaa = !aaaaaaaa( // break aaaaaaaaaaa); *aaaaaa = aaaaaaa( // break aaaaaaaaaaaaaaaa);
After: bool aaaa = !aaaaaaaa( // break aaaaaaaaaaa); // <- (unchanged) *aaaaaa = aaaaaaa( // break aaaaaaaaaaaaaaaa); // <- (no longer indented relative to "*")
llvm-svn: 189108
show more ...
|
#
f438cb76 |
| 23-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix corner case for string splitting ..
.. in conjunction with Style.AlwaysBreakBeforeMultilineStrings. Also, simplify the implementation by handling newly split strings and already sp
clang-format: Fix corner case for string splitting ..
.. in conjunction with Style.AlwaysBreakBeforeMultilineStrings. Also, simplify the implementation by handling newly split strings and already split strings by the same code.
llvm-svn: 189102
show more ...
|
#
f93551c8 |
| 23-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Handle trailing commas in column layout of braced list.
Before, this was causing errors.
Also exit early in breakProtrudingToken() (before the expensive call to SourceManager::getSpel
clang-format: Handle trailing commas in column layout of braced list.
Before, this was causing errors.
Also exit early in breakProtrudingToken() (before the expensive call to SourceManager::getSpellingColumnNumber()). This makes formatting huge (100k+-item) braced lists possible.
llvm-svn: 189094
show more ...
|
#
8de9ed05 |
| 22-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Add column layout formatting for braced lists
With this patch, braced lists (with more than 3 elements are formatted in a column layout if possible). E.g.:
static const uint16_t Cal
clang-format: Add column layout formatting for braced lists
With this patch, braced lists (with more than 3 elements are formatted in a column layout if possible). E.g.:
static const uint16_t CallerSavedRegs64Bit[] = { X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI, X86::R8, X86::R9, X86::R10, X86::R11, 0 };
Required other changes: - FormatTokens can now have a special role that contains extra data and can do special formattings. A comma separated list is currently the only implementation. - Move penalty calculation entirely into ContinuationIndenter (there was a last piece still in UnwrappedLineFormatter).
Review: http://llvm-reviews.chandlerc.com/D1457 llvm-svn: 189018
show more ...
|
#
f110e201 |
| 21-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Indent relative to unary operators.
Before: if (!aaaaaaaaaa( // break aaaaa)) { }
After: if (!aaaaaaaaaa( // break aaaaa)) { }
Also cleaned up formatti
clang-format: Indent relative to unary operators.
Before: if (!aaaaaaaaaa( // break aaaaa)) { }
After: if (!aaaaaaaaaa( // break aaaaa)) { }
Also cleaned up formatting using clang-format.
llvm-svn: 188891
show more ...
|
#
2b41a82e |
| 20-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Format enum struct/class like enum.
Patch by Joe Hermaszewski. Thank you!
llvm-svn: 188794
|
#
b55acad9 |
| 20-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Additional options for spaces around parentheses.
This patch adds four new options to control: - Spaces after control keyworks (if(..) vs if (..)) - Spaces in empty parentheses (f( ) v
clang-format: Additional options for spaces around parentheses.
This patch adds four new options to control: - Spaces after control keyworks (if(..) vs if (..)) - Spaces in empty parentheses (f( ) vs f()) - Spaces in c-style casts (( int )1.0 vs (int)1.0) - Spaces in other parentheses (f(a) vs f( a ))
Patch by Joe Hermaszewski. Thank you for working on this!
llvm-svn: 188793
show more ...
|
#
5364306e |
| 19-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Fix return type line break decision.
This accidentally introduced by r186077, as function names were not correctly recognized in templated declarations.
Before: template <class Temp
clang-format: Fix return type line break decision.
This accidentally introduced by r186077, as function names were not correctly recognized in templated declarations.
Before: template <class TemplateIt> SomeReturnType SomeFunction(TemplateIt begin, TemplateIt end, TemplateIt* stop) {}
After: template <class TemplateIt> SomeReturnType SomeFunction(TemplateIt begin, TemplateIt end, TemplateIt* stop) {}
llvm-svn: 188665
show more ...
|
#
cdaffa45 |
| 13-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Add option for the offset of constructor initializers.
Some coding styles use a different indent for constructor initializers.
Patch by Klemens Baum. Thank you. Review: http://llvm-re
clang-format: Add option for the offset of constructor initializers.
Some coding styles use a different indent for constructor initializers.
Patch by Klemens Baum. Thank you. Review: http://llvm-reviews.chandlerc.com/D1360
Post review changes: Changed data type to unsigned as a negative indent width does not make sense and added test for configuration parsing.
llvm-svn: 188260
show more ...
|
#
29a98cfc |
| 13-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve boolean expression formatting in macros.
Before: #define IF(a, b, c) if (a&&(b == c))
After: #define IF(a, b, c) if (a && (b == c))
llvm-svn: 188256
|
#
70dc91aa |
| 13-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Activate WebKit-style tests for MS compilers.
They were accidentally placed in the #if.
llvm-svn: 188255
|
#
301d0171 |
| 13-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Slightly adapt line break penalties.
Before: aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa) ->aaaaaaaaa()); After: aaaaaaaaaaaaaaa
clang-format: Slightly adapt line break penalties.
Before: aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa) ->aaaaaaaaa()); After: aaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa)->aaaaaaaaa());
llvm-svn: 188253
show more ...
|
#
467ddb16 |
| 12-Aug-2013 |
Daniel Jasper <djasper@google.com> |
clang-format: Improve stream-formatting.
Before: CHECK(controller->WriteProto(FLAGS_row_key, FLAGS_proto)) << "\"" << FLAGS_proto
clang-format: Improve stream-formatting.
Before: CHECK(controller->WriteProto(FLAGS_row_key, FLAGS_proto)) << "\"" << FLAGS_proto << "\"";
After: SemaRef.Diag(Loc, diag::note_for_range_begin_end) << BEF << IsTemplate << Description << E->getType();
llvm-svn: 188175
show more ...
|