summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* clang-format: Fix incorrect detection of QT-signals access specifier.Daniel Jasper2016-07-271-1/+1
| | | | | | | | | | | | | | | | | Before: void f() { label: signals .baz(); } After: void f() { label: signals.baz(); } llvm-svn: 276854
* clang-format: [Proto] Fix "import public" after r273179.Daniel Jasper2016-06-201-0/+2
| | | | llvm-svn: 273196
* clang-format: [Proto] Don't do bad things if imports are missing ;.Daniel Jasper2016-06-201-4/+15
| | | | llvm-svn: 273179
* clang-format: [JS] no ASI on `import {x as\n y}`.Martin Probst2016-06-011-5/+5
| | | | | | | | | | | | Summary: ASI did not handle the ES6 `as` operator correctly. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D20817 llvm-svn: 271401
* clang-format: [JS] fix async parsing.Martin Probst2016-05-291-4/+9
| | | | | | | | | | | | | | Summary: Only treat the sequence `async function` as the start of a function expression, as opposed to every occurrence of the token `async` (whoops). Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D20737 llvm-svn: 271184
* clang-format: Fix incorrect indentation in last line of macro definitionDaniel Jasper2016-05-191-0/+2
| | | | | | | | | | | | | | | | | | Before: #define MACRO(a) \ if (a) { \ f(); \ } else \ g() After: #define MACRO(a) \ if (a) { \ f(); \ } else \ g() llvm-svn: 270028
* clang-format: Support enum type template arguments.Daniel Jasper2016-05-081-0/+7
| | | | | | | | | | | | | Before: template <enum E> class A { public : E *f(); }; After: template <enum E> class A { public: E *f(); }; llvm-svn: 268878
* clang-format: [JS] generator and async functions.Martin Probst2016-04-241-8/+23
| | | | | | | | | | | | | | | For generators, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_generators async functions are not quite in the spec yet, but stage 3 and already widely used: http://tc39.github.io/ecmascript-asyncawait/ Reviewers: djasper Subscribers: klimek Differential Revision: http://reviews.llvm.org/D19204 llvm-svn: 267368
* reuse mustBeJSIdent for interface detectionMartin Probst2016-04-191-7/+8
| | | | llvm-svn: 266790
* clang-format: [JS] support `interface` as a free standing identifier.Martin Probst2016-04-191-0/+15
| | | | | | | | | | | | | | | Summary: `interface` can be used as a fee standing identifier in JavaScript/TypeScript. This change uses the heuristic of whether it's followed by another identifier as an indication. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D19240 llvm-svn: 266789
* clang-format: [JS] simplify import/export.Martin Probst2016-04-191-9/+9
| | | | | | | | | | | | | | | | | | | Summary: Change `import` and `export` parsing to special case the renaming syntax (`import x, {y as bar} ...`, `export {x}`) and otherwise just parse a regular structural element. This simplifies the code a bit and should be more correct - it's easier to recognise the specific import syntax than to recognise arbitrary expressions and declarations. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D19242 llvm-svn: 266743
* clang-format: Last line in incomplete block is indented incorrectlyMarianne Mailhot-Sarrasin2016-04-141-0/+3
| | | | | | | | | | Indentation of the last line was reset to the initial indentation of the block when reaching EOF. Patch by Maxime Beaulieu Differential Revision: http://reviews.llvm.org/D19065 llvm-svn: 266321
* [clang-format] Walk backwards from end() instead of forwards from rend().Benjamin Kramer2016-04-111-1/+1
| | | | | | | | This should've been forwards from rbegin(), reverse iterators are just too confusing to be used by mere mortals. Fixes out-of-bounds walks over the list. llvm-svn: 265934
* clang-format: [JS] do not insert semicolons after wrapped annotations.Martin Probst2016-04-111-0/+7
| | | | | | | | | | Reviewers: djasper Subscribers: klimek Differential Revision: http://reviews.llvm.org/D18943 llvm-svn: 265916
* clang-format: Fix label-in-if statement in macros where it is actually used.Daniel Jasper2016-04-061-1/+3
| | | | | | | | | | | | | | | | Before: #define A \ if (a) \ label: \ f() After: #define A \ if (a) \ label: \ f() llvm-svn: 265557
* clang-format: Support labels in brace-less ifs.Daniel Jasper2016-04-061-0/+3
| | | | | | | | | | | | | | | | While I am not personally convinced about the usefulness of this construct, we should break it. Before: if (a) label: f(); After: if (a) label: f(); llvm-svn: 265545
* clang-format: [JS] Handle certain cases of ASI.Daniel Jasper2016-03-141-1/+71
| | | | | | | | | | | | | | Automatic Semicolon Insertion can only be properly handled by parsing source code. However conservatively catching just a few, common situations prevents breaking code during development, which greatly improves usability. JS code should still use semicolons, and ASI code should be flagged by a compiler or linter. Patch by Martin Probst. Thank you. llvm-svn: 263470
* clang-format: [JS] Support destructuring assignments in for loops.Daniel Jasper2016-03-051-0/+2
| | | | | | | | | | | | Before: for (let { a, b } of x) { } After: for (let {a, b} of x) { } llvm-svn: 262776
* clang-format: [JS/TypeScript] Support "enum" as an optional property name, too.Daniel Jasper2016-02-031-1/+2
| | | | | | | | | | | Before: enum?: string []; After: enum?: string[]; llvm-svn: 259628
* clang-format: [JS] Support exporting abstract classes.Daniel Jasper2016-01-121-0/+4
| | | | | | | | | | | Before: export abstract class X {y: number;} (and all sorts of other havoc in more complicated cases). After: export abstract class X { y: number; } llvm-svn: 257451
* clang-format: [JS] Teach clang-format about "export interface".Daniel Jasper2016-01-111-1/+2
| | | | llvm-svn: 257406
* clang-format: [JS] Support semicolons in TypeScript's TypeMemberLists.Daniel Jasper2016-01-091-44/+67
| | | | | | | | | | | | | | Before: var x: { a: string; b: number; } = {}; After: var x: {a: string; b: number;} = {}; llvm-svn: 257255
* clang-format: [JS] Support more ES6 classes.Daniel Jasper2016-01-081-0/+2
| | | | | | | | | | | | | | | Before: foo = class { constructor() {} } ; After: foo = class { constructor() {} }; llvm-svn: 257154
* clang-format: [JS] Support more ES6 imports.Daniel Jasper2016-01-071-8/+7
| | | | | | | | | | | Before: import a, {X, Y} from 'some/module.js'; After: import a, {X, Y} from 'some/module.js'; llvm-svn: 257038
* clang-format: [JS/TypeScript] Support "enum" as property name.Daniel Jasper2015-12-291-7/+16
| | | | | | | | | | | Before: enum: string []; After: enum: string[]; llvm-svn: 256546
* clang-format: [TableGen] Support ;-less include lines.Daniel Jasper2015-12-251-1/+9
| | | | llvm-svn: 256412
* clang-format: [JS] Support arrays of object-type literals.Daniel Jasper2015-12-221-1/+1
| | | | | | | | | | | | | | | Before: interface I { o: {} []; } After: interface I { o: {}[]; } llvm-svn: 256247
* clang-format: Properly set the BlockKind for more blocks.Daniel Jasper2015-12-211-1/+3
| | | | | | | | | | | | | | | Before: void f() { struct Dummy { }; f(); } After: void f() { struct Dummy {}; f(); } llvm-svn: 256175
* clang-format: treat Q_SIGNALS as an access modifierDaniel Jasper2015-12-011-1/+2
| | | | | | Patch by Alexander Richardson, thank you! llvm-svn: 254407
* Format: support inline namespacesSaleem Abdulrasool2015-10-301-1/+1
| | | | | | | | Correct handling for C++17 inline namespaces. We would previously fail to identify the inline namespaces as a namespace name since multiple ones may be concatenated now with C++17. llvm-svn: 251690
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* clang-format: Fix false ObjC block detection.Daniel Jasper2015-10-071-0/+5
| | | | | | | | | | | Before: inline A operator^(const A &lhs, const A &rhs) {} int i; After: inline A operator^(const A &lhs, const A &rhs) {} int i; llvm-svn: 249517
* clang-format: Add a new brace style "custom" as well as flags toDaniel Jasper2015-09-291-41/+22
| | | | | | | | | | | | | | | control the individual braces. The existing choices for brace wrapping are now merely presets for the different flags that get expanded upon calling the reformat function. All presets have been chose to keep the existing formatting, so there shouldn't be any difference in formatting behavior. Also change the dump_format_style.py to properly document the nested structs that are used to keep these flags discoverable among all the configuration flags. llvm-svn: 248802
* clang-format: [JS] Support pseudo-keywordsDaniel Jasper2015-09-281-0/+5
| | | | | | | | | JavaScript allows keywords to appear in IdenfierName positions, e.g. fields, or object literal members, but not as plain identifiers. Patch by Martin Probst. Thank you! llvm-svn: 248714
* clang-format: [JS] handle let (ES6)Daniel Jasper2015-09-281-1/+1
| | | | | | Patch by Martin Probst. Thank you! llvm-svn: 248713
* clang-format: Properly handle braced lists in macros.Daniel Jasper2015-08-241-0/+2
| | | | | | | | | | | | Before: #define A \ { a, a } \ , After: #define A {a, a}, llvm-svn: 245837
* clang-format: Fix incorrect lambda-detection.Daniel Jasper2015-08-131-0/+1
| | | | | | | | | | Before: [ a, a ]() -> a<1>{}; After: [a, a]() -> a<1> {}; llvm-svn: 244890
* clang-format: [Proto] Handle enum bodies differently.Daniel Jasper2015-07-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | In proto, enum constants can contain complex options and should be handled more like individual declarations. Before: enum Type { UNKNOWN = 0 [(some_options) = { a: aa, b: bb }]; }; After: enum Type { UNKNOWN = 0 [(some_options) = { a: aa, b: bb }]; }; llvm-svn: 242404
* clang-format: Add Mozilla brace breaking styleBirunthan Mohanathas2015-07-121-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D10883 llvm-svn: 241986
* clang-format: [JS] Properly reset parse state after parsing interface.Daniel Jasper2015-07-061-1/+1
| | | | llvm-svn: 241446
* clang-format: Add MacroBlock{Begin,End} optionsBirunthan Mohanathas2015-07-031-3/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 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: 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: 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
* 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: clang-format (NFC)Daniel Jasper2015-06-171-6/+3
| | | | llvm-svn: 239903
* 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: [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
OpenPOWER on IntegriCloud