summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: Support weird lambda macros.Daniel Jasper2016-01-071-0/+1
| | | | | | | | | | Before: MACRO((AA & a) { return 1; }); After: MACRO((AA &a) { return 1; }); llvm-svn: 257062
* clang-format: [JS] Support more ES6 imports.Daniel Jasper2016-01-071-0/+1
| | | | | | | | | | | Before: import a, {X, Y} from 'some/module.js'; After: import a, {X, Y} from 'some/module.js'; llvm-svn: 257038
* clang-format: Fix corner case in "if it saves columns"-calculation.Daniel Jasper2016-01-051-1/+4
| | | | | | | | | | | | | | | Before: aaaa .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) .aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: aaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) .aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 256841
* clang-format: Handle \n the same way as std::endl with stream operator.Daniel Jasper2016-01-051-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang-format breaks multi-line streams after std::endl. It now also break for '\n', the suggested replacement for std::endl: http://llvm.org/docs/CodingStandards.html#avoid-std-endl Before: llvm::errs() << aaaaaaaaaaaaaaaaaaaaaa << '\n' << bbbbbbbbbbbbbbbbbbbbbb << '\n'; llvm::errs() << aaaa << "aaaaaaaaaaaaaaaaaa\n" << bbbb << "bbbbbbbbbbbbbbbbbb\n"; After: llvm::errs() << aaaaaaaaaaaaaaaaaaaaaa << '\n' << bbbbbbbbbbbbbbbbbbbbbb << '\n'; llvm::errs() << aaaa << "aaaaaaaaaaaaaaaaaa\n" << bbbb << "bbbbbbbbbbbbbbbbbb\n"; This changeset ensure that multiline streams have a line break after: - std::endl - '\n' - "\n" - "Some Text\n" Patch by Jean-Philippe Dufraigne, thank you. llvm-svn: 256832
* clang-format: Avoid creating hanging indents in call sequences.Daniel Jasper2016-01-051-2/+10
| | | | | | | | | | | | | | Before: aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaa) .aaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa) .aaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 256831
* clang-format: Improve line wrapping behavior in call sequences.Daniel Jasper2016-01-051-6/+11
| | | | | | | | | | | | | | | r256750 has been leading to an undesired behavior: aaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaaa.aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); This change increases penalty for wrapping before member accesses that aren't calls. Thus, this is again formatted as (as it has been before r256750): aaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaa.aaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 256830
* clang-format: [JS] Support more ES6 default exports.Daniel Jasper2016-01-041-0/+1
| | | | llvm-svn: 256759
* clang-format: [JS] Support ES6 exports of array literals.Daniel Jasper2016-01-041-0/+5
| | | | | | | | | | | | | | | | Before: export default[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb]; export default[]; After: export default [ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ]; export default []; llvm-svn: 256758
* clang-format: [JS] Improve empty array literal detection.Daniel Jasper2016-01-041-0/+2
| | | | | | | | | | | | | | | Previously, the [] in the following example were recognized as an array subscript leading to weird indentation. Before: var aaaa = aaaaa || // wrap []; After: var aaaa = aaaaa || // wrap []; llvm-svn: 256753
* clang-format: Fix corner case in builder-type call formatting.Daniel Jasper2016-01-041-0/+4
| | | | | | | | | | | | | | Before: return aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa) .aaaa(aaaaaaaaaaaaaa); After: return aaaaaaaaaaaaaaaa .aaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa) .aaaa(aaaaaaaaaaaaaa); llvm-svn: 256750
* clang-format: Align long braced init lists even if they are nested inDaniel Jasper2016-01-041-0/+9
| | | | | | function calls. llvm-svn: 256740
* clang-format: Fix corner case for lambda assignments.Daniel Jasper2016-01-041-0/+2
| | | | | | | | | | | | Before: std::function<std::string(const std::string &)> my_lambda = []( const string &s) { return s; }; After: std::function<std::string(const std::string &)> my_lambda = [](const string &s) { return s; }; llvm-svn: 256739
* clang-format: Fix corner-case in ObjC method declaration formattingDaniel Jasper2016-01-041-0/+5
| | | | | | | | | | | | | | | | | | Before: - (void)shortf:(GTMFoo *)theFoo longKeyword:(NSRect)theRect longerKeyword:(float)theInterval error:(NSError **)theError { } After: - (void)shortf:(GTMFoo *)theFoo longKeyword:(NSRect)theRect longerKeyword:(float)theInterval error:(NSError **)theError { } llvm-svn: 256738
* clang-format: [Proto] Basic support for options with <> for repeated fields.Daniel Jasper2016-01-041-0/+6
| | | | llvm-svn: 256737
* clang-format: [Proto] Improve wrapping of message field attributes.Daniel Jasper2016-01-041-6/+22
| | | | | | | | | | | | | | | | | | | | | | | Before: optional AAA aaa = 1 [foo = { key: "a" // }, bar = { key: "a" // }]; After: optional AAA aaa = 1 [ foo = { key: "a" // }, bar = { key: "a" // } ]; llvm-svn: 256736
* clang-format: Slightly row back on r256343 by increasing penalty forDaniel Jasper2015-12-301-0/+2
| | | | | | | | | | | | | breaking between array subscripts. Before: if (aaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa] [aaaaaaaaaaaaa]) After: if (aaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa][aaaaaaaaaaaaa]) llvm-svn: 256640
* clang-format: [JS] Support TypeScript 1.6 user defined type guards.Daniel Jasper2015-12-301-0/+8
| | | | | | | | | | | | | | | | Before: function foo(check: Object): check is{foo: string, bar: string, baz: string, foobar: string} { return 'bar' in check; } After: function foo(check: Object): check is {foo: string, bar: string, baz: string, foobar: string} { return 'bar' in check; } llvm-svn: 256631
* clang-format: [JS/TypeScript] Support "enum" as property name.Daniel Jasper2015-12-291-0/+1
| | | | | | | | | | | Before: enum: string []; After: enum: string[]; llvm-svn: 256546
* clang-format: Fix incorrect function type detection.Daniel Jasper2015-12-281-0/+1
| | | | | | | | | | Before: int x = f (&h)(); After: int x = f(&h)(); llvm-svn: 256488
* clang-format: [TableGen] Support ;-less include lines.Daniel Jasper2015-12-251-0/+6
| | | | llvm-svn: 256412
* clang-format: Lower penalty for breaking between array subscripts.Daniel Jasper2015-12-231-0/+2
| | | | | | | | | | | | Before: aaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaa(aaaaaaaaaaaa)][bbbbbbbbbbb( bbbbbbbbbbbb)] After: aaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaa(aaaaaaaaaaaa)] [bbbbbbbbbbb(bbbbbbbbbbbb)] llvm-svn: 256343
* clang-format: Fix incorrect pointer detection.Daniel Jasper2015-12-231-0/+1
| | | | | | | | | | Before: return * this += 1; After: return *this += 1; llvm-svn: 256342
* [ASTMatchers] Add booleanType() matcher.Samuel Benzaquen2015-12-221-0/+7
| | | | llvm-svn: 256278
* clang-format: [JS] Support arrays of object-type literals.Daniel Jasper2015-12-221-0/+5
| | | | | | | | | | | | | | | Before: interface I { o: {} []; } After: interface I { o: {}[]; } llvm-svn: 256247
* clang-format: [JS] Conservatively introduce column layout for JS arrayDaniel Jasper2015-12-221-0/+11
| | | | | | | | initializers. For now, only use it for 20 items or more. Otherwise, clang-format formats these one-per-line and thus increases the vertical code size a lot. llvm-svn: 256246
* clang-format: [JS] "operator" is not a keyword in Java/JavaScript.Daniel Jasper2015-12-222-0/+6
| | | | llvm-svn: 256245
* clang-format: Properly set the BlockKind for more blocks.Daniel Jasper2015-12-211-1/+7
| | | | | | | | | | | | | | | Before: void f() { struct Dummy { }; f(); } After: void f() { struct Dummy {}; f(); } llvm-svn: 256175
* clang-format: Only consider the first #include that looks right to beDaniel Jasper2015-12-211-0/+11
| | | | | | the main #include. llvm-svn: 256170
* clang-format: [JS] Change Google-style default for aligning operands.Daniel Jasper2015-12-211-8/+8
| | | | | | The style guide allows both, but apparently, this is the more dominant use. llvm-svn: 256154
* clang-format: Only try to find the "main" include in the first block ofDaniel Jasper2015-12-211-0/+13
| | | | | | includes. llvm-svn: 256153
* clang-format: Extend detection of the "main" #include to use the filenameDaniel Jasper2015-12-211-5/+25
| | | | | | | | | | | Before, the first (non-system) header in a file was considered to be the main include. This is conservative as it makes clang-format change the #include order less often. Instead implement some basic usage of the filename itself. With this patch, clang-format considers every header to be a main include if the header file's basename is a prefix to the filename the #include is in. llvm-svn: 256148
* Fix invalid enum comparison.Zachary Turner2015-12-181-1/+1
| | | | llvm-svn: 256055
* Support AlwaysBreakAfterReturnTypeZachary Turner2015-12-181-7/+74
| | | | | | | | | | | This changes the behavior of AlwaysBreakAfterDeclarationReturnType so that it supports breaking after declarations, definitions, or both. Differential Revision: http://reviews.llvm.org/D10370 Reviewed By: Daniel Jasper llvm-svn: 256046
* Add a test for r255875 & r255929, comparisons on DynTypeNode wrapped QualType.Richard Trieu2015-12-171-0/+7
| | | | llvm-svn: 255937
* clang-format: Extend header sort category implementation.Daniel Jasper2015-12-161-0/+8
| | | | | | | | | | Specifically, it is sometimes necessary to keep certain #includes as the first #include, even before the main #include for a .cc file. Switching the category to be signed instead of unsigned isn't ideal, but it seems as good of an option as any and is fully backwards compatible. llvm-svn: 255757
* Add a new matcher to match character types.Gabor Horvath2015-12-151-0/+8
| | | | llvm-svn: 255627
* clang-format: Add test for AlignAfterOpenBracket = AlwaysBreak in C++.Daniel Jasper2015-12-141-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revision 251405 added AlwaysBreak to support Google's JavaScript style. This changeset complete existing AlignsAfterOpenBracket tests to exercise AlwaysBreak for C++. I thought this would be worthwhile. With this option we can support request from http://lists.llvm.org/pipermail/cfe-dev/2015-May/042942.html, that had been requested a few times. This also partially solve related Bug 23422 and is probably sufficient for most people. AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak; BinPackArguments = false; BinPackParameters = false; With these setting we obtain this formatting: void fooWithAVeryLongParamList( int firstParameter, int secondParameter int lastParameter) { object.alsoThisDoenstFitSoIBreakImmidiatly( firstParameter, secondParameter, lastParameter); } Patch by Jean-Philippe Dufraigne, thank you. llvm-svn: 255486
* clang-format: Extend Linux-brace-wrapping test.Daniel Jasper2015-12-141-0/+2
| | | | llvm-svn: 255485
* [VFS] Fix status() of opened redirected fileBen Langmuir2015-12-101-1/+26
| | | | | | | | | | | | | | | Make RedirectedFileSystem::openFilForRead(path)->status() the same as RedirectedFileSystem::status(path). Previously we would just get the status of the underlying real file, which would not have the IsVFSMapped bit set. This fixes rebuilding a module that has an include that is relative to the includer where we will lookup the real path of that file before we lookup the VFS location. rdar://problem/23640339 llvm-svn: 255312
* clang-format: Make wrapping after "./->" cheaper, even if the elementDaniel Jasper2015-12-071-4/+14
| | | | | | | | | | | | | | | | | | | before it is not a closing parenthesis. Otherwise, this frequently leads to "hanging" indents that users perceive as "weird". Before: return !soooooooooooooome_map.insert( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) .second; After: return !soooooooooooooome_map .insert(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) .second; llvm-svn: 254933
* [CMake] Don't build the libclang tests unless you're building libclangChris Bieneman2015-12-041-1/+1
| | | | | | This fixes a build issue reported by users at Apple. llvm-svn: 254797
* Add a narrowing AST matcher that matches on a FunctionDecl with a ↵Aaron Ballman2015-12-021-0/+9
| | | | | | non-throwing exception specification. llvm-svn: 254516
* Traverse the NestedNameSpecifier(Loc) of NamespaceAliasDecls.Daniel Jasper2015-12-021-0/+2
| | | | | Review: http://reviews.llvm.org/D15149 llvm-svn: 254510
* Avoid picking up system headers in unittest by providing a fake libstdc++ ↵Benjamin Kramer2015-12-011-2/+4
| | | | | | | | | with a ridiculously high version number. The host libstdc++ may be horribly broken and we want the fake one to be picked up. This workaround is lame but I don't see a better way. llvm-svn: 254446
* clang-format: Make it possible to turn off comment reflowing.Daniel Jasper2015-12-011-0/+8
| | | | llvm-svn: 254414
* clang-format: treat Q_SIGNALS as an access modifierDaniel Jasper2015-12-011-3/+13
| | | | | | Patch by Alexander Richardson, thank you! llvm-svn: 254407
* This fixes https://llvm.org/bugs/show_bug.cgi?id=25329, as well asDaniel Jasper2015-12-011-1/+55
| | | | | | | | | | | misalignments like the following: int a, b = 2; int c = 3; Patch by Beren Minor, thanks! llvm-svn: 254406
* Add --gcc-toolchain= to one of the libclang unitests to fix issue related to Samuel Antao2015-11-301-1/+2
| | | | | | | the gcc libraries clang picks for when it was configures with a user defined path. llvm-svn: 254306
* clang-format: Re-add code path deleted in r253873 and add missing test.Daniel Jasper2015-11-231-0/+1
| | | | llvm-svn: 253900
* Add an AST matcher for narrowing when a type is volatile-qualified.Aaron Ballman2015-11-231-0/+9
| | | | llvm-svn: 253882
OpenPOWER on IntegriCloud