summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: [JS] Treat regex literals like string literals.Daniel Jasper2015-07-021-0/+4
| | | | | | | 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-0/+2
| | | | llvm-svn: 241264
* When testing for anyOf(), the test should not be for an exact type match for ↵Aaron Ballman2015-07-021-0/+4
| | | | | | all members of the set. Instead, test that all members are convertible to the common type. llvm-svn: 241263
* 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-0/+1
| | | | llvm-svn: 241259
* clang-format: [JS] Fix character counting in template strings.Daniel Jasper2015-07-021-7/+7
| | | | | | | 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
* Implement an AST matcher for C++ exception catch handlers that can catch any ↵Aaron Ballman2015-07-021-0/+4
| | | | | | exception type (...). llvm-svn: 241256
* clang-format: Support member function reference qualifiers withDaniel Jasper2015-07-011-5/+8
| | | | | | | | | | | | | | 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-0/+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
* Add two missing arguments.Adrian Prantl2015-06-301-0/+2
| | | | | | I forgot to add this file to r241035. llvm-svn: 241036
* clang-format: Add option to break after definition return type for top-level ↵Birunthan Mohanathas2015-06-291-9/+37
| | | | | | | | functions only Differential Revision: http://reviews.llvm.org/D10774 llvm-svn: 240959
* clang-format: Don't indent relative to unary operators (some more).Daniel Jasper2015-06-291-4/+6
| | | | | | | | | | | | | | | | 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: Support @autoreleasepool.Nico Weber2015-06-281-0/+21
| | | | | | | | | | 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-0/+4
| | | | | | | | | | 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-0/+6
| | | | llvm-svn: 240548
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-2212-12/+12
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-2212-12/+12
| | | | | | | | | | | | 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
* Introduce a PCHContainerOperations interface (NFC).Adrian Prantl2015-06-201-0/+1
| | | | | | | | | | | | | | | | A PCHContainerOperations abstract interface provides operations for creating and unwrapping containers for serialized ASTs (precompiled headers and clang modules). The default implementation is RawPCHContainerOperations, which uses a flat file for the output. The main application for this interface will be an ObjectFilePCHContainerOperations implementation that uses LLVM to wrap the module in an ELF/Mach-O/COFF container to store debug info alongside the AST. rdar://problem/20091852 llvm-svn: 240225
* clang-format: Make exception to AlwaysBreakBeforeMultilineStrings moreDaniel Jasper2015-06-191-0/+4
| | | | | | | | | | | | | | | | | | 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-0/+4
| | | | | | | The previous one (r240021) regressed: enum E Type::f() { .. } llvm-svn: 240127
* clang-format: Row back on the AlwaysBreakBeforeMultilineStrings change.Daniel Jasper2015-06-181-4/+9
| | | | | | | | | | | | | | | 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-1/+13
| | | | | | | | | 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-0/+4
| | | | | | | | | | | | | | | | | | | | 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-format: Make AlwaysBreakBeforeMultilineStrings more conservative.Daniel Jasper2015-06-181-15/+14
| | | | | | | | | | | | | | | | | 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-173-34/+33
| | | | llvm-svn: 239903
* clang-format: Don't generate unnecessary replacements for \r\n line endings.Daniel Jasper2015-06-171-0/+7
| | | | | | 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-0/+8
| | | | | | | | | | | 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-0/+8
| | | | | | | | | | | | | | | | | | | Patch by Martin Probst. Before: enum { A, B } var x = 1; After: enum { A, B } var x = 1; llvm-svn: 239893
* Avoid using set::emplace as it is apparently not supported by gcc 4.7.Daniel Jasper2015-06-161-2/+2
| | | | llvm-svn: 239816
* Tooling: When applying a set of replacements, do deletions beforeDaniel Jasper2015-06-161-0/+13
| | | | | | | | insertions. It is unlikely to be the intention to delete parts of newly inserted code. To do so, changed sorting Replacements at the same offset to have decreasing length. llvm-svn: 239809
* clang-format: NFC. Move testing of selective formatting to a separate file.Daniel Jasper2015-06-153-402/+448
| | | | | | | This is a first step for splitting the huge FormatTest.cpp into separate files to make it easier to find specific tests. llvm-svn: 239730
* clang-format: [JS] Tweak behavior for multiline array initializer parametersDaniel Jasper2015-06-151-0/+7
| | | | | | | | | | | | | | | | | | | | | 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-0/+5
| | | | | | | | | | 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: 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-0/+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-0/+5
| | | | llvm-svn: 239595
* clang-format: [JS] Add tests to ensure clang-format doesn't break codeDaniel Jasper2015-06-121-0/+12
| | | | | | | | by triggering automatic semicolon insertion changes. NFC intended. Patch by Martin Probst. llvm-svn: 239594
* clang-format: [JS] Fix regression caused by r239592.Daniel Jasper2015-06-121-1/+2
| | | | | | | | | | 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-0/+3
| | | | | | | | | | | | | 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-11/+8
| | | | | | | | | | 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/+4
| | | | | | And fix formatting issue discovered by that :-). llvm-svn: 239530
* Fix crash in clang-format.Manuel Klimek2015-06-111-1/+4
| | | | | | | | | | | The following example used to crash clang-format. #define a\ /**/} Adjusting the indentation level cache for the line starting with the comment would lead to an out-of-bounds array read. llvm-svn: 239521
* clang-format: Don't add spaces in foreach macro definition.Daniel Jasper2015-06-111-0/+12
| | | | | | | | | | | | Before clang-format would e.g. add a space into #define Q_FOREACH(x, y) which turns this into a non-function-like macro. Patch by Strager Neds, thank you! llvm-svn: 239513
* clang-format: [JS] Only special case top level object literalDaniel Jasper2015-06-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | assignments as enums. Top level object literals are treated as enums, and their k/v pairs are put on separate lines: X.Y = { A: 1, B: 2 }; However assignments within blocks should not be affected: function x() { y = {a:1, b:2}; } This change fixes the second case. Patch by Martin Probst. llvm-svn: 239462
* clang-format: Support //!-comments, increase test coverage.Daniel Jasper2015-06-091-0/+16
| | | | llvm-svn: 239404
* Move a test from static-assert.cpp to DeclPrinterTestDavid Majnemer2015-06-051-0/+18
| | | | | | | | It's better not to rely on the diagnostics engine to pretty print the argument to decltype. Instead, exercise the functionality in DeclPrinterTest. llvm-svn: 239197
* clang-format: More eagerly wrap trailing return types.Daniel Jasper2015-06-051-0/+4
| | | | | | | | | | | | | | | | | Before: template <typename T> auto aaaaaaaaaaaaaaaaaaaaaa(T t) -> decltype(eaaaaaaaaaaaaaaa<T>(t.a) .aaaaaaaa()); After: template <typename T> auto aaaaaaaaaaaaaaaaaaaaaa(T t) -> decltype(eaaaaaaaaaaaaaaa<T>(t.a).aaaaaaaa()); Also add a test case for a difficult template parsing case I stumbled accross. Needs fixing. llvm-svn: 239149
* clang-format: [JS] Let fat arrows have 'Assignment' precedence.Daniel Jasper2015-06-051-1/+8
| | | | | | | | | | | | | | | | | This is a more correct representation than using "Equality" introduced in r238942 which was a quick fix to solve an actual regression. According to the typescript spec, arrows behave like "low-precedence" assignments. Before: var a = a.aaaaaaa((a: a) => aaaaaaaaaaaaaaaaaaaaa(bbbbbbbbb) && aaaaaaaaaaaaaaaaaaaaa(bbbbbbb)); After: var a = a.aaaaaaa((a: a) => aaaaaaaaaaaaaaaaaaaaa(bbbbbbbbb) && aaaaaaaaaaaaaaaaaaaaa(bbbbbbb)); llvm-svn: 239137
* clang-format: [JS] Let fat arrows have 'Equality' precedence.Daniel Jasper2015-06-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | | This fixes a regression in literal formatting: Before: aaaaaaaaaaaaa = { aaaaaaaaaaaaaaaaaaaaaaaaaaaa: (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) => aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, }; After: var aaaaaaaaaaaaaaaaaaaa = { aaaaaaaaaaaaaaaaaaaaaaaaaaaa: (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) => aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, }; Also apply no-else-after-return policy. llvm-svn: 238942
* Allow replacements created from token ranges to specify language options.Manuel Klimek2015-06-031-0/+25
| | | | | | | | The default language options will lead to incorrect replacements in C++ code, for example when trying to replace nested name specifiers ending in "::". llvm-svn: 238922
OpenPOWER on IntegriCloud