summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: Break after "for (" less eagerly.Daniel Jasper2015-07-071-1/+2
| | | | | | | | | | | | | | | | Before: for ( auto aaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); aaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbbbbbbb; ++aaaaaaaaaaaaaaaaaaaaaaaaaaa) { After: for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); aaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbbbbbbb; ++aaaaaaaaaaaaaaaaaaaaaaaaaaa) { llvm-svn: 241601
* clang-format: Don't wrap before the ] of a lambda introducer.Daniel Jasper2015-07-071-0/+3
| | | | | | | | | | | | | | | | Before: return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa([= ](int iiiiiiiiiiii) { return aaaaaaaaaaaaaaaaaaaaaaa != aaaaaaaaaaaaaaaaaaaaaaa; }); After: return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa([=]( int iiiiiiiiiiii) { return aaaaaaaaaaaaaaaaaaaaaaa != aaaaaaaaaaaaaaaaaaaaaaa; }); llvm-svn: 241583
* clang-format: [JS] Properly reset parse state after parsing interface.Daniel Jasper2015-07-061-1/+1
| | | | llvm-svn: 241446
* clang-format: [JS] Prevent confusing TypeScript parameters wraps.Daniel Jasper2015-07-061-1/+1
| | | | | | | | | | | | | Before: aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa): aaaaaaaaaaaaaaaaaaaaaa {} After: aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa): aaaaaaaaaaaaaaaaaaaaaa {} llvm-svn: 241444
* clang-format: Fix __attribute__ being treated as decl name.Daniel Jasper2015-07-061-1/+2
| | | | | | | | | | | __attribute__ was treated as the name of a function definition, with the tokens in parentheses being the parameter list. This formats incorrectly with AlwaysBreakAfterDefinitionReturnType. Fix it by treating __attribute__ like decltype. Patch by Strager Neds, thank you. llvm-svn: 241439
* clang-format: Add MacroBlock{Begin,End} optionsBirunthan Mohanathas2015-07-033-10/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MacroBlockBegin and MacroBlockEnd options make matching macro identifiers behave like '{' and '}', respectively, in terms of indentation. Mozilla code, for example, uses several macros that begin and end a scope. Previously, Clang-Format removed the indentation resulting in: MACRO_BEGIN(...) MACRO_ENTRY(...) MACRO_ENTRY(...) MACRO_END Now, using the options MacroBlockBegin: "^[A-Z_]+_BEGIN$" MacroBlockEnd: "^[A-Z_]+_END$" will yield the expected result: MACRO_BEGIN(...) MACRO_ENTRY(...) MACRO_ENTRY(...) MACRO_END Differential Revision: http://reviews.llvm.org/D10840 llvm-svn: 241363
* clang-format: [JS] Allow line breaks after TypeScript type colons.Daniel Jasper2015-07-031-0/+2
| | | | llvm-svn: 241339
* clang-format: [Java/JS] Properly support instanceof and its precedence.Daniel Jasper2015-07-031-2/+7
| | | | llvm-svn: 241337
* clang-format: [JS] Treat regex literals like string literals.Daniel Jasper2015-07-021-0/+2
| | | | | | | Using the token type "unknown" can interfere badly with WhitespaceManager's way of handling multiline comments. llvm-svn: 241273
* clang-format: [JS] Skip comments when applying the regex-literal heuristicDaniel Jasper2015-07-021-5/+9
| | | | llvm-svn: 241264
* clang-format: [JS] Fix bug in regex literal parsing.Daniel Jasper2015-07-021-0/+1
| | | | | | The lexer wasn't properly reset leading to unexpected deletions. llvm-svn: 241262
* clang-format: [JS] Support regex literals at the start of a file.Daniel Jasper2015-07-021-5/+6
| | | | llvm-svn: 241259
* clang-format: [JS] Fix character counting in template strings.Daniel Jasper2015-07-021-5/+6
| | | | | | | Some counts were off, we don't need to take the leading newlines of the first ` into account and some tests were just wrong. llvm-svn: 241257
* clang-format: Support member function reference qualifiers withDaniel Jasper2015-07-011-1/+1
| | | | | | | | | | | | | | trailing return types. Before: template <typename T> auto x() & -> int {} After: template <typename T> auto x() & -> int {} llvm-svn: 241188
* clang-format: Properly parse parenthesis in braced lists.Daniel Jasper2015-06-301-3/+2
| | | | | | | | | | | Among other things, this makes clang-format understand arbitrary blocks embedded in them, such as: SomeFunction({MACRO({ return output; }), b}); where MACRO could e.g. expand to a lambda. llvm-svn: 241059
* clang-format: Add option to break after definition return type for top-level ↵Birunthan Mohanathas2015-06-293-5/+23
| | | | | | | | functions only Differential Revision: http://reviews.llvm.org/D10774 llvm-svn: 240959
* clang-format: Adjust Mozilla style defaultsBirunthan Mohanathas2015-06-291-3/+5
| | | | | | | | Summary: This makes the Mozilla style defaults more compliant with the Mozilla style guide. A few options were removed in order to use the LLVM style defaults. Differential Revision: http://reviews.llvm.org/D10771 llvm-svn: 240957
* clang-format: Don't indent relative to unary operators (some more).Daniel Jasper2015-06-291-1/+1
| | | | | | | | | | | | | | | | Before: long aaaaaaaa = !aaaa( // break aaaaaa); long aaaaaaaa = !aa.aa( // break aaaaaa); After: long aaaaaaaa = !aaaa( // break aaaaaa); long aaaaaaaa = !aa.aa( // break aaaaaa); llvm-svn: 240934
* clang-format: Stop old options from overriding new optionsBirunthan Mohanathas2015-06-281-10/+10
| | | | | | | | | | | | | | Summary: Depends on D10785. Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D10786 llvm-svn: 240909
* clang-format: Alphabetize FormatStyle membersBirunthan Mohanathas2015-06-281-33/+33
| | | | | | | | | | | | Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D10784 llvm-svn: 240907
* clang-format: Support @autoreleasepool.Nico Weber2015-06-281-0/+10
| | | | | | | | | | Format @autoreleasepool properly for the Attach brace style by recognizing @autoreleasepool as a block introducer. Patch from Strager Neds! http://reviews.llvm.org/D10372 llvm-svn: 240896
* clang-format: [Proto] Don't treat "operator" as keyword.Daniel Jasper2015-06-251-5/+6
| | | | | | | | | | Before: optional string operator= 1; After: optional string operator = 1; llvm-svn: 240624
* clang-format: [JS] Support regex literals containing quotes (' and ").Daniel Jasper2015-06-241-3/+23
| | | | llvm-svn: 240548
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-2/+2
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-2/+2
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* clang-format: Make exception to AlwaysBreakBeforeMultilineStrings moreDaniel Jasper2015-06-191-1/+1
| | | | | | | | | | | | | | | | | | conservative. In particular, this fixes an unwanted corner case. Before: string s = someFunction("aaaa" "bbbb"); After: string s = someFunction( "aaaa" "bbbb"); llvm-svn: 240129
* clang-format: Better fix to detect elaborated enum return types.Daniel Jasper2015-06-191-3/+8
| | | | | | | The previous one (r240021) regressed: enum E Type::f() { .. } llvm-svn: 240127
* Fix "the the" in comments/documentation/etc.Eric Christopher2015-06-191-1/+1
| | | | llvm-svn: 240110
* clang-format: Row back on the AlwaysBreakBeforeMultilineStrings change.Daniel Jasper2015-06-181-1/+2
| | | | | | | | | | | | | | | It was a bit too aggressive. With this patch, we keep on breaking here: aaaaaaaaaaaaa(aaaaaaa, "aaaaaaa" "bbbbbbb"); But don't break in: aaaaaaaaaaaaa(aaaaaaa, aaaaaaaa("aaaaaaa" "bbbbbbb")); llvm-svn: 240024
* clang-format: Better support functions with elaborated enum return types.Daniel Jasper2015-06-181-0/+2
| | | | | | | | | Before, this wasn't formatted properly: enum ::C f() { return a; } llvm-svn: 240021
* clang-format: [JS] Add a special case for indenting function literals.Daniel Jasper2015-06-181-1/+15
| | | | | | | | | | | | | | | | | | | | Before: var func = function() { doSomething(); }; After: var func = function() { doSomething(); }; This is a very narrow special case which fixes most of the discrepency with what our users do. In the long run, we should try to come up with a more generic fix for indenting these. llvm-svn: 240014
* [clang] Refactoring of conditions so they use isOneOf() instead of multiple ↵Daniel Marjamaki2015-06-181-1/+1
| | | | | | is(). llvm-svn: 240008
* clang-format: Make AlwaysBreakBeforeMultilineStrings more conservative.Daniel Jasper2015-06-181-7/+9
| | | | | | | | | | | | | | | | | In essence this is meant to consistently indent multiline strings by a fixed amount of spaces from the start of the line. Don't do this in cases where it wouldn't help anyway. Before: someFunction(aaaaa, "aaaaa" "bbbbb"); After: someFunction(aaaaa, "aaaaa" "bbbbb"); llvm-svn: 240004
* clang-format: clang-format (NFC)Daniel Jasper2015-06-179-46/+33
| | | | llvm-svn: 239903
* clang-format: Don't generate unnecessary replacements for \r\n line endings.Daniel Jasper2015-06-171-1/+1
| | | | | | Patch by Mathieu Champlon. Thank you. llvm-svn: 239900
* clang-format: [JS] Don't put top-level typescript enums on a single line.Daniel Jasper2015-06-171-27/+34
| | | | | | | | | | | This makes this consistent with non-typescript enums. Also shuffle the language-dependent stuff in mustBreakBefore to a single location. Patch initiated by Martin Probst. llvm-svn: 239894
* clang-format: [JS] Fix typescript enum formatting.Daniel Jasper2015-06-171-5/+13
| | | | | | | | | | | | | | | | | | | Patch by Martin Probst. Before: enum { A, B } var x = 1; After: enum { A, B } var x = 1; llvm-svn: 239893
* clang-format: NFC. Add a function to test whether an annotated lineDaniel Jasper2015-06-173-23/+39
| | | | | | | starts with a given sequence of tokens. Only the one-token version is used yet, but other usages are coming up momentarily. llvm-svn: 239892
* clang-format: [JS] Tweak behavior for multiline array initializer parametersDaniel Jasper2015-06-151-1/+2
| | | | | | | | | | | | | | | | | | | | | Before: var someVariable = SomeFuntion(aaaa, [ aaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccc ], aaaa); After: var someVariable = SomeFuntion(aaaa, [ aaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccc ], aaaa); llvm-svn: 239722
* clang-format: [JS] Fix corner case in template string parsing.Daniel Jasper2015-06-141-1/+2
| | | | | | | | | | Before, these would not properly detected because of the char/string literal found when re-lexing after the first `: var x = `'`; // comment with matching quote ' var x = `"`; // comment with matching quote " llvm-svn: 239693
* [clang-format] Use in-class initializers to simplify constructor.Benjamin Kramer2015-06-121-17/+14
| | | | | | Sadly C++11 doesn't let us use initializers on bitfield members (DR1341). NFC. llvm-svn: 239606
* [clang-format] Reorder and pack ParenState members to minimize paddingBenjamin Kramer2015-06-121-36/+36
| | | | | | sizeof(ParenState) goes from 64 bytes to 52 bytes. NFC. llvm-svn: 239605
* [clang-format] Hoist vector allocation out of loop. NFC.Benjamin Kramer2015-06-121-2/+5
| | | | llvm-svn: 239604
* clang-format: Always add space before lambda-{Daniel Jasper2015-06-121-0/+1
| | | | | | | | | | | | Before: int c = []() -> int *{ return 2; }(); After: int c = []() -> int * { return 2; }(); Based on patch by James Dennett (http://reviews.llvm.org/D10410), thank you! llvm-svn: 239600
* clang-format: Understand C-style case in case label.Daniel Jasper2015-06-121-1/+1
| | | | | | | | | | | | Before: case (my_int) ONE: After: case (my_int)ONE: This fixed llvm.org/PR23760 llvm-svn: 239597
* clang-format: [JS] Support "export enum" declarations.Daniel Jasper2015-06-121-1/+2
| | | | llvm-svn: 239595
* clang-format: [JS] Fix regression caused by r239592.Daniel Jasper2015-06-121-0/+1
| | | | | | | | | | Without it, it would do: interface I { x: string; } var y; llvm-svn: 239593
* clang-format: [JS] fix incorrectly collapsed lines after exportDaniel Jasper2015-06-121-6/+8
| | | | | | | | | | | | | statement. When an exported function would follow a class declaration, it would not be recognized as a stand-alone function. That would then collapse the following line with the current one, e.g. class C {} export function f() {} var x; llvm-svn: 239592
* clang-format: Make SFS_Inline imply SFS_Empty.Daniel Jasper2015-06-111-1/+1
| | | | | | | | | | In the long run, these two might be independent or we might to only allow specific combinations. Until we have a corresponding request, however, it is hard to do the right thing and choose the right configuration options. Thus, just don't touch the options yet and just modify the behavior slightly. llvm-svn: 239531
* clang-format: [JS] Ensure that formatting actually takes place in tests.Daniel Jasper2015-06-111-1/+1
| | | | | | And fix formatting issue discovered by that :-). llvm-svn: 239530
OpenPOWER on IntegriCloud