summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
* clang-format: Fix incorrect detection of ObjC "in" keyword.Daniel Jasper2014-12-181-0/+1
| | | | | | | | | | Before: for (auto v : in [1]) { .. After: for (auto v : in[1]) { .. llvm-svn: 224513
* clang-format: Fix incorrect calculation of token lenghts.Daniel Jasper2014-12-171-0/+2
| | | | | | This led, e.g. to break JavaScript regex literals too early. llvm-svn: 224419
* Add voidType() matcher.Samuel Benzaquen2014-12-151-0/+5
| | | | | | | | | | | | Summary: Add voidType() matcher. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6656 llvm-svn: 224250
* Don't break single-line raw string literals.Alexander Kornienko2014-12-141-21/+8
| | | | | | | | | | | | Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6636 llvm-svn: 224223
* Don't break string literals in Java and JavaScript.Alexander Kornienko2014-12-121-0/+7
| | | | | | | | The proper way to break string literals in these languages is by inserting a "+" between parts which we don't support yet. So we disable string literal breaking until then. llvm-svn: 224120
* clang-format: Revamp nested block formatting.Daniel Jasper2014-12-122-6/+35
| | | | | | | | | | | | | | | | | | | | | | This fixed llvm.org/PR21804 and hopefully a few other strange cases. Before: if (blah_blah(whatever, whatever, [] { doo_dah(); doo_dah(); })) { } } After: if (blah_blah(whatever, whatever, [] { doo_dah(); doo_dah(); })) { } } llvm-svn: 224112
* clang-format: Add a test for PR19603 which seems fixed (maybe by r221338?).Nico Weber2014-12-091-0/+3
| | | | llvm-svn: 223850
* clang-format: Indent correctly in conditional expressions after return.Daniel Jasper2014-12-081-0/+5
| | | | | | | | | | | | | | | | | | | This only applies when not aligning after the return itself (which is commonly done for C++. Before: return aaaaaaaaaa ? bbbbbbbbbb( bbbbbb) // This is indented relative to aaaaaaaaaa. : b; After: return aaaaaaaaaa ? bbbbbbbbbb( bbbbbb) : b; llvm-svn: 223694
* clang-format: [Java] Always break after annotations of multiline decls.Daniel Jasper2014-12-081-0/+4
| | | | | | | | | | | | | Before: @Mock DataLoader loooooooooooooooooooooooader = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; After: @Mock DataLoader loooooooooooooooooooooooader = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; llvm-svn: 223688
* clang-format: Support commas in lambda return types.Daniel Jasper2014-12-081-0/+1
| | | | | | | | | | Before: auto next_pair = [](A * a) -> pair<A*, A*>{}; After: auto next_pair = [](A* a) -> pair<A*, A*>{}; llvm-svn: 223652
* clang-format: Don't merge lines with comments.Daniel Jasper2014-12-071-0/+5
| | | | | | | | | | | | | | Before: int f() { // comment return 42; } After: int f() { // comment return 42; } This fixes llvm.org/PR21769. llvm-svn: 223609
* Make DiagnosticErrorTrap work even if SuppressAllDiagnostics is enabled.Richard Smith2014-12-052-0/+50
| | | | | | Patch by Brad King! llvm-svn: 223525
* clang-format: Support NS_OPTIONS, CF_ENUM and CF_OPTIONS.Daniel Jasper2014-12-051-0/+15
| | | | | | This fixes llvm.org/PR21756. llvm-svn: 223458
* clang-format: [JS] Don't put top-level dict literals on a single line.Daniel Jasper2014-12-041-9/+12
| | | | | | | These are often used for enums which apparently are easier to read if formatted with one element per line. llvm-svn: 223367
* clang-format: More restrictively classify import declarations.Daniel Jasper2014-12-041-0/+4
| | | | | | | | | | | Before: import::SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: import::SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 223345
* Make ArgumentsAdjuster an std::function.Alexander Kornienko2014-12-031-22/+11
| | | | | | | | | | | | Reviewers: klimek Reviewed By: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6505 llvm-svn: 223248
* clang-format: Fix fake parentheses placement with comments.Daniel Jasper2014-12-031-0/+7
| | | | | | | | | | | | | | | | Before: return (a > b // comment1 // comment2 || c); After: return (a > b // comment1 // comment2 || c); llvm-svn: 223234
* clang-format: Fix expression parser not closing stuff at end of stmt.Daniel Jasper2014-12-031-0/+5
| | | | | | | | | | | | | | Uncovered by a Java test case: Before: public some.package.Type someFunction( // comment int parameter) {} After: public some.package.Type someFunction( // comment int parameter) {} llvm-svn: 223228
* clang-format: Add option to suppress operator alignment.Daniel Jasper2014-12-022-3/+62
| | | | | | | | | | | | | | | | With alignment: int aaaaaa = aa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb * cccccccccccccccccccccccccccccccc; Without alignment: int aaaaaa = aa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb * cccccccccccccccccccccccccccccccc; This fixes llvm.org/PR21666. llvm-svn: 223117
* clang-format: precedence-based indentation when breaking before operators.Daniel Jasper2014-12-021-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa > ccccccccccccccccccccccccccccccccccccccccc; After: bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa > ccccccccccccccccccccccccccccccccccccccccc; Not particularly pretty, but can probably help to uncover bugs. And if this bugs somebody, parentheses can help. llvm-svn: 223111
* clang-format: [JS] Contract fewer functions to a single line.Daniel Jasper2014-11-271-0/+5
| | | | | | | | | | | | | Before: var someVariable = function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); }; After: var someVariable = function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); }; llvm-svn: 222893
* clang-format: [JS] Try not to break in container literals.Daniel Jasper2014-11-271-0/+5
| | | | | | | | | | | | | | | | | Before: var obj = { fooooooooo: function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); } }; After: var obj = { fooooooooo: function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); } }; llvm-svn: 222892
* clang-format: [JS] new and delete are valid function names.Daniel Jasper2014-11-271-0/+2
| | | | | | | | | | | | Before: someObject.new (); someObject.delete (); After: someObject.new(); someObject.delete(); llvm-svn: 222890
* clang-format: [JS] Make Closure module detection more narrow.Daniel Jasper2014-11-271-0/+5
| | | | | | | | | | | Before: var MyLongClassName = goog.module.get('my.long.module.name.followedBy.MyLongClassName'); After: var MyLongClassName = goog.module.get('my.long.module.name.followedBy.MyLongClassName'); llvm-svn: 222888
* clang-format: Don't use column layout with AlignAfterOpenBrackets.Daniel Jasper2014-11-271-0/+7
| | | | | | This fixes llvm.org/PR21676. llvm-svn: 222886
* clang-format: [Java] Don't line-wrap package declarations.Daniel Jasper2014-11-261-0/+5
| | | | | | This fixes llvm.org/PR21677. llvm-svn: 222843
* clang-format: Tweak -style=Chromium for Java files.Nico Weber2014-11-261-0/+15
| | | | | | | | | | | For Java, don't do any of the deviations from Google Style that Chromium style does for C++. Chromium's Java follows Android Java style [1], which is roughly Google Java style with an indent of 4 and a continuation indent of 8. 1: https://source.android.com/source/code-style.html llvm-svn: 222839
* clang-format: [Java] Improve formatting of throws declarations.Daniel Jasper2014-11-261-0/+2
| | | | | | | | | | | | Before: public void doSoooooooooo() throws LoooooooooongException, LooooooooooongException {} After: public void doSoooooooooo() throws LoooooooooongException, LooooooooooongException {} llvm-svn: 222829
* clang-format: [Java] Improve cast detection.Daniel Jasper2014-11-261-0/+4
| | | | | | | | | | Before: a[b >> 1] = (byte)(c() << 4); After: a[b >> 1] = (byte) (c() << 4); llvm-svn: 222827
* clang-format: [Java] Fix breaking after annotations.Daniel Jasper2014-11-261-0/+3
| | | | | | | | | | | | | Before: @Annotation1 // comment @Annotation2 class C {} After: @Annotation1 // comment @Annotation2 class C {} llvm-svn: 222825
* clang-format: Add SFS_Empty to only empty functions on a single line.Daniel Jasper2014-11-262-35/+25
| | | | | | | | Activated for and tested by Google's Java style. This fixes llvm.org/PR21667. llvm-svn: 222819
* clang-format: [Java] Support Foo.class;Daniel Jasper2014-11-261-0/+5
| | | | | | | | | | | | | Before: SomeClass. class.getName(); After: SomeClass.class.getName(); This fixes llvm.org/PR21665. llvm-svn: 222813
* Re-apply r222646 (was reverted in r222667). Adding 4 ASTMatchers: ↵Manuel Klimek2014-11-252-5/+60
| | | | | | | | | | | | | | | | | | | | | | | typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName Change to original: ifndef out tests in Windows due to /-separated paths. Summary: Often one is only interested in matches within the main-file or matches that are not within a system-header, for which this patch adds isInMainFile and isInSystemFile. They take no arguments and narrow down the matches. The isInFileMatchingName is mainly thought for interactive clang-query-sessions, to make a matcher more specific without restarting the session with the files you are interested in for that moment. It takes a string that will be used as regular-expression to match the filename of where the matched node is expanded. Patch by Hendrik von Prince. llvm-svn: 222765
* clang-format: Refactoring.Daniel Jasper2014-11-251-0/+11
| | | | | | Re-apply r222638 and r222641 without variadic templates. llvm-svn: 222747
* Reverting r222646; the tests do not pass on Windows. Also reverts r222664, ↵Aaron Ballman2014-11-242-55/+5
| | | | | | which was required for r222646 to compile with Visual Studio 2012. llvm-svn: 222667
* Unbreaking the MSVC 2012 build; however, these tests still fail on Windows.Aaron Ballman2014-11-241-5/+12
| | | | llvm-svn: 222664
* Reverting r222638; it broke the MSVC build bots because Visual Studio 2012 ↵Aaron Ballman2014-11-241-11/+0
| | | | | | does not support variadic templates. Also reverting r222641 because it was relying on 222638. llvm-svn: 222656
* Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, ↵Manuel Klimek2014-11-242-5/+48
| | | | | | | | | | | | | | | | | | | | isInFileMatchingName Summary: Often one is only interested in matches within the main-file or matches that are not within a system-header, for which this patch adds isInMainFile and isInSystemFile. They take no arguments and narrow down the matches. The isInFileMatchingName is mainly thought for interactive clang-query-sessions, to make a matcher more specific without restarting the session with the files you are interested in for that moment. It takes a string that will be used as regular-expression to match the filename of where the matched node is expanded. Patch by Hendrik von Prince. llvm-svn: 222646
* clang-format: Make short case labels work with #ifsDaniel Jasper2014-11-231-0/+6
| | | | | | | | | | | | | | | | | | | Before: switch (a) { #if FOO case 0: return 0; #endif } After: switch (a) { #if FOO case 0: return 0; #endif } This fixed llvm.org/PR21544. llvm-svn: 222642
* clang-format: [Java] Treat 'instanceof' like other binary operators.Daniel Jasper2014-11-231-0/+11
| | | | | | This fixes llvm.org/PR21436. llvm-svn: 222641
* clang-format: [Java] Space before array initializers.Daniel Jasper2014-11-231-2/+9
| | | | | | | | | | Before: new int[]{1, 2, 3, 4}; After: new int[] {1, 2, 3, 4}; llvm-svn: 222640
* clang-format: Improve ObjC blocks with return type.Daniel Jasper2014-11-231-0/+1
| | | | | | | | | | | | Before: Block b = ^int * (A * a, B * b) {} After: Block b = ^int *(A *a, B *b) {} This fixed llvm.org/PR21619. llvm-svn: 222639
* clang-format: [JS] Support Closure's module statements.Daniel Jasper2014-11-231-0/+11
| | | | | | | These are like import statements and should not be line-wrapped. Minor restructuring of the handling of other import statements. llvm-svn: 222637
* clang-format: Understand more lambda return types.Daniel Jasper2014-11-211-0/+3
| | | | | | | | | | Before: auto a = [&b, c ](D * d) -> D * {} After: auto a = [&b, c](D* d) -> D* {} llvm-svn: 222534
* clang-format: Use nested block special case for all languages.Daniel Jasper2014-11-212-22/+53
| | | | | | | | | | | | | | | | | | | Previously this was only used for JavaScript. Before: functionCall({ int i; int j; }, aaaa, bbbb, cccc); After: functionCall({ int i; int j; }, aaaa, bbbb, cccc); llvm-svn: 222531
* clang-format: Handle comments in short case labels.Daniel Jasper2014-11-211-0/+5
| | | | | | | | | | | | | | | With AllowShortCaseLabelsOnASingleLine set to true: This gets now left unchanged: case 1: // comment return; Whereas before it was changed into: case 1: // comment return; This fixes llvm.org/PR21630. llvm-svn: 222529
* clang-format: [Java] Support more Java keywords.Daniel Jasper2014-11-211-0/+2
| | | | | | | | | | | | | | | | | | Before: public final<X> Foo foo() { } public abstract<X> Foo foo(); After: public final <X> Foo foo() { } public abstract <X> Foo foo(); Patch by Harry Terkelsen. Thank you. llvm-svn: 222527
* clang-format: [Java] Basic lambda support.Daniel Jasper2014-11-211-0/+15
| | | | llvm-svn: 222524
* clang-format: [Java] Don't align after "return".Daniel Jasper2014-11-201-0/+15
| | | | | | | | | | | | | | | | | | Doesn't seem to be common practice in Java. Before: return aaaaaaaaaaaaaaaaaaa && bbbbbbbbbbbbbbbbbbb && ccccccccccccccccccc; After: return aaaaaaaaaaaaaaaaaaa && bbbbbbbbbbbbbbbbbbb && ccccccccccccccccccc; Patch by Harry Terkelsen. llvm-svn: 222424
* clang-format: [Java] Don't force break before generic type method.Daniel Jasper2014-11-201-0/+7
| | | | | | | | | | | | | | | Before: Foo.bar() .<X> baz(); After: Foo.bar() .<X>baz(); Patch by Harry Terkelsen. llvm-svn: 222423
OpenPOWER on IntegriCloud