summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: [JS] post-fix non-null assertion operator.Martin Probst2016-06-131-0/+9
| | | | | | | | | | | | | | Summary: Do not insert whitespace preceding the "!" postfix operator. This is an incomplete fix, but should cover common usage. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D21204 llvm-svn: 272524
* Revert "[ASTMatchers] New forEachOverriden matcher."Chandler Carruth2016-06-111-44/+0
| | | | | | | This reverts commit r272386. It doesn't compile with MSVC and those bots have been red the entire day as a consequence. llvm-svn: 272453
* [ASTMatchers] New forEachOverriden matcher.Clement Courbet2016-06-101-0/+44
| | | | | | Matches methods overridden by the given method. llvm-svn: 272386
* clang-format: [JS] recognized named functions in AnnotatingParser.Martin Probst2016-06-091-0/+2
| | | | | | | | | | | | | | | Summary: This also fixes union type formatting in function parameter types. Before: function x(path: number| string) {} After: function x(path: number|string) {} Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D21206 llvm-svn: 272330
* Revert "[Temporary] Add an ExprWithCleanups for each C++ ↵Tim Shen2016-06-091-2/+2
| | | | | | | | | MaterializeTemporaryExpr." This reverts r272296, since there are clang-tidy failures that appear to be caused by this change. llvm-svn: 272310
* [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr.Tim Shen2016-06-091-2/+2
| | | | | | | | | | | These ExprWithCleanups are added for holding a RunCleanupsScope not for destructor calls; rather, they are for lifetime marks. This requires ExprWithCleanups to keep a bit to indicate whether it have cleanups with side effects (e.g. dtor calls). Differential Revision: http://reviews.llvm.org/D20498 llvm-svn: 272296
* Prune away some unused using decls. NFC.Benjamin Kramer2016-06-083-11/+0
| | | | | | Found by clang's misc-unused-using-decls. llvm-svn: 272156
* clang-format: [JS] fix an assertion failure caused by shrinking sources.Martin Probst2016-06-081-0/+13
| | | | | | | | | | | | | | | | | | Summary: The JavaScript import sorter has a corner condition that can cause the overall source text length to shrink. This change circumvents the issue by appending trailing space in the line after the import blocks to match at least the previous source code length. This needs a better long term fix, but this fixes the immediate issue. Reviewers: alexeagle, djasper Subscribers: klimek Differential Revision: http://reviews.llvm.org/D21108 llvm-svn: 272142
* clang-format: Fix incorrect calculation of "length" of /**/ comments.Daniel Jasper2016-06-081-0/+8
| | | | | | This could lead to column limit violations. llvm-svn: 272125
* clang-format: Fix bug in function ref qualifier identification.Daniel Jasper2016-06-081-0/+1
| | | | | | | | | | | | | | .. and simplify it. Before: void A::f()&& {} void f() && {} After: void A::f() && {} void f() && {} llvm-svn: 272124
* Make isNoThrow and hasDynamicExceptionSpec polymorphic so they can be used ↵Aaron Ballman2016-06-071-0/+21
| | | | | | | | with both functionDecl and functionPrototype matchers. Patch by Don Hinton. llvm-svn: 272028
* Adding an AST matcher to ignore parenthesis in *types* (rather than ↵Aaron Ballman2016-06-061-0/+7
| | | | | | expressions). This is required for traversing certain types (like function pointer types). llvm-svn: 271927
* [clang-format] make header guard identification stricter (with Lexer).Eric Liu2016-06-061-0/+80
| | | | | | | | | | | | Summary: make header guard identification stricter with Lexer. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D20959 llvm-svn: 271883
* [clang-format] skip empty lines and comments in the top of the code when ↵Eric Liu2016-06-031-7/+78
| | | | | | | | | | | | | | | | | inserting new headers. Summary: [clang-format] skip empty lines and comments in the top of the code when inserting new headers. Pair-programmed with @hokein Reviewers: djasper Subscribers: ioeric, cfe-commits, hokein, klimek Differential Revision: http://reviews.llvm.org/D20898 llvm-svn: 271664
* clang-format: [JS] no ASI on `import {x as\n y}`.Martin Probst2016-06-011-0/+3
| | | | | | | | | | | | 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] Sort imported symbols.Martin Probst2016-06-011-0/+27
| | | | | | | | | | | | Summary: E.g. sort `import {b, a} from 'x';` into `import {a, b} from 'x';`. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D20798 llvm-svn: 271400
* [ASTMatchers] Breaking change of `has` matcherPiotr Padlewski2016-05-312-16/+10
| | | | | | | | has matcher can now match to implicit and paren casts http://reviews.llvm.org/D20801 llvm-svn: 271288
* [clang-format] insert new #includes into correct blocks when cleaning up ↵Eric Liu2016-05-311-16/+272
| | | | | | | | | | | | | | | | | Replacement with cleanupAroundReplacements(). Summary: When a replacement's offset is set to UINT_MAX or -1U, it is treated as a header insertion replacement by cleanupAroundReplacements(). The new #include directive is then inserted into the correct block. Reviewers: klimek, djasper Subscribers: klimek, cfe-commits, bkramer Differential Revision: http://reviews.llvm.org/D20734 llvm-svn: 271276
* [ASTMatchers] Add support of hasCondition for SwitchStmt.Etienne Bergeron2016-05-301-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The switch statement could be added to the hasCondition matcher. Example: ``` clang-query> match switchStmt(hasCondition(ignoringImpCasts(declRefExpr()))) ``` Output: ``` Match #1: Binding for "root": SwitchStmt 0x2f9b528 </usr/local/google/home/etienneb/examples/enum.cc:35:3, line:38:3> |-<<<NULL>>> |-ImplicitCastExpr 0x2f9b510 <line:35:11> 'int' <IntegralCast> | `-ImplicitCastExpr 0x2f9b4f8 <col:11> 'enum Color' <LValueToRValue> | `-DeclRefExpr 0x2f9b4d0 <col:11> 'enum Color' lvalue Var 0x2f9a118 'C' 'enum Color' `-CompoundStmt 0x2f9b610 <col:14, line:38:3> |-CaseStmt 0x2f9b578 <line:36:3, col:22> | |-ImplicitCastExpr 0x2f9b638 <col:8> 'int' <IntegralCast> | | `-DeclRefExpr 0x2f9b550 <col:8> 'enum Size' EnumConstant 0x2f99e40 'Small' 'enum Size' | |-<<<NULL>>> | `-ReturnStmt 0x2f9b5d0 <col:15, col:22> | `-IntegerLiteral 0x2f9b5b0 <col:22> 'int' 1 `-DefaultStmt 0x2f9b5f0 <line:37:3, col:12> `-BreakStmt 0x2f9b5e8 <col:12> 1 match. ``` Reviewers: aaron.ballman, sbenza, klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D20767 llvm-svn: 271208
* clang-format: Fix segfault introduced by allowing wraps after comments.Daniel Jasper2016-05-291-0/+5
| | | | llvm-svn: 271191
* clang-format: [JS] Support shebang lines on the very first line.Martin Probst2016-05-291-0/+7
| | | | | | | | | | | | | | | Summary: Shebang lines (`#!/bin/blah`) can be used in JavaScript scripts to indicate they should be run using e.g. node. This change treats # lines on the first line as line comments. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D20632 llvm-svn: 271185
* clang-format: [JS] fix async parsing.Martin Probst2016-05-291-0/+4
| | | | | | | | | | | | | | 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: Allow splitting the line after /**/-comments.Daniel Jasper2016-05-271-0/+2
| | | | | | | While it might change the meaning of the comment in rare circumstances, it is better than violating the column limit. llvm-svn: 270975
* [clang-format] moved unit tests related to replacements cleaner from ↵Eric Liu2016-05-272-29/+41
| | | | | | FormatTest.cpp to CleanUpTest.cpp. llvm-svn: 270971
* clang-format: [JS] sort ES6 imports.Martin Probst2016-05-202-0/+202
| | | | | | | | | | | | | | | | | | Summary: This change automatically sorts ES6 imports and exports into four groups: absolute imports, parent imports, relative imports, and then exports. Exports are sorted in the same order, but not grouped further. To keep JS import sorting out of Format.cpp, this required extracting the TokenAnalyzer infrastructure to separate header and implementation files. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D20198 llvm-svn: 270203
* clang-format: [JS] Treat "for" as a reserved word after a ".".Daniel Jasper2016-05-201-0/+1
| | | | | | | | Otherwise, clang-format can get confused with statements like: x.for = 1; llvm-svn: 270188
* [Lexer] Don't merge macro args from different macro filesVedant Kumar2016-05-191-2/+24
| | | | | | | | | | | | | | | | | | The lexer sets the end location of macro arguments incorrectly *if*, while merging consecutive args to fit into a single SLocEntry, it finds args which come from different macro files. Fix the issue by using separate SLocEntries in this situation. This fixes a code coverage crasher (rdar://problem/26181005). Because the lexer reported end locations for certain macro args incorrectly, we would generate bogus coverage mappings with negative line offsets. Reviewed-by: akyrtzi Differential Revision: http://reviews.llvm.org/D20401 llvm-svn: 270160
* [Sema] Allow an external sema source to handle delayed typo corrections.Benjamin Kramer2016-05-191-21/+80
| | | | | | | This probably isn't perfectly perfect but allows correcting function calls again. llvm-svn: 270039
* clang-format: [JS] Fix spacing in destructuring assignments.Daniel Jasper2016-05-191-0/+1
| | | | | | | | | | Before: const[a, b, c] = [1, 2, 3]; After: const [a, b, c] = [1, 2, 3]; llvm-svn: 270029
* clang-format: Fix incorrect indentation in last line of macro definitionDaniel Jasper2016-05-191-0/+6
| | | | | | | | | | | | | | | | | | Before: #define MACRO(a) \ if (a) { \ f(); \ } else \ g() After: #define MACRO(a) \ if (a) { \ f(); \ } else \ g() llvm-svn: 270028
* clang-format: Fix enumerator case ranges.Daniel Jasper2016-05-191-0/+1
| | | | | | | | | | Before: case a... b: break; After: case a ... b: break; llvm-svn: 270027
* [ASTMacther] A follow-up on unresolvedLookupExpr test fixing.Haojian Wu2016-05-181-1/+4
| | | | llvm-svn: 269957
* [ASTMatcher] Fix a ASTMatcher test failure on Windows.Haojian Wu2016-05-181-7/+8
| | | | | | | | | | Reviewers: alexfh, aaron.ballman Subscribers: thakis, cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D20369 llvm-svn: 269936
* [clang-format] Make formatReplacements() also sort #includes.Eric Liu2016-05-181-0/+25
| | | | | | | | | | | | Summary: [clang-format] Make formatReplacements() also sort #includes. Reviewers: bkramer, djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D20362 llvm-svn: 269924
* [ASTMatcher] Add a node matcher for UnresolvedLookupExpr.Haojian Wu2016-05-181-0/+9
| | | | | | | | | | Reviewers: alexfh, aaron.ballman Subscribers: aaron.ballman, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D20360 llvm-svn: 269916
* Make clang-format cleaner remove redundant commas in list and redundant ↵Eric Liu2016-05-181-0/+127
| | | | | | | | | | | | | | colon in constructor initializer. Summary: Make clang-format cleaner remove redundant commas/colons in constructor initializer list. Reviewers: klimek, djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D19804 llvm-svn: 269888
* Dividied ASTMatcherTests into 4 filesPiotr Padlewski2016-05-177-5650/+5703
| | | | | | | fix for long compilation [20061] http://reviews.llvm.org/D20210 llvm-svn: 269802
* clang-format: [JS] fix template string width counting.Martin Probst2016-05-171-0/+9
| | | | | | | | | | | | | | | Summary: Simply looking at the final text greatly simplifies the algorithm and also fixes a reported issue. This requires duplicating the "actual encoding width" logic, but that seems cleaner than the column acrobatics before. Reviewers: djasper, bkramer Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D20208 llvm-svn: 269747
* Add the hasDynamicExceptionSpec() AST matcher to match function declarations ↵Aaron Ballman2016-05-161-0/+16
| | | | | | | | that have a dynamic exception specification. Patch by Don Hinton. llvm-svn: 269662
* [VFS] Add level() method to vfs::recursive_directory_iteratorBruno Cardoso Lopes2016-05-141-0/+42
| | | | | | | | | | | | | Unlike sys::fs::recursive_directory_iterator, vfs::recursive_directory_iterator does not implement the level() method, which tells how deep in the directory tree the current iterator is. This is needed in the vfs::recursive_directory_iterator so that future improvements to the crash reproducer will be able to properly access header for umbrellas when looking into the VFS. rdar://problem/25880368 llvm-svn: 269520
* Add an AST matcher for CastExpr kindEtienne Bergeron2016-05-131-0/+9
| | | | | | | | | | | | | | Summary: This AST matcher will match a given CastExpr kind. It's an narrowing matcher on CastExpr. Reviewers: klimek, alexfh, sbenza, aaron.ballman Subscribers: Prazek, jroelofs, aaron.ballman, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D19871 llvm-svn: 269460
* [VFS] Reapply #2: Reconstruct the VFS overlay tree for more accurate lookupBruno Cardoso Lopes2016-05-121-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reapply r269100 and r269270, reverted due to https://llvm.org/bugs/show_bug.cgi?id=27725. Isolate the testcase that corresponds to the new feature side of this commit and skip it on windows hosts until we find why it does not work on these platforms. Original commit message: The way we currently build the internal VFS overlay representation leads to inefficient path search and might yield wrong answers when asked for recursive or regular directory iteration. Currently, when reading an YAML file, each YAML root entry is placed inside a new root in the filesystem overlay. In the crash reproducer, a simple "@import Foundation" currently maps to 43 roots, and when looking up paths, we traverse a directory tree for each of these different roots, until we find a match (or don't). This has two consequences: - It's slow. - Directory iteration gives incomplete results since it only return results within one root - since contents of the same directory can be declared inside different roots, the result isn't accurate. This is in part fault of the way we currently write out the YAML file when emitting the crash reproducer - we could generate only one root and that would make it fast and correct again. However, we should not rely on how the client writes the YAML, but provide a good internal representation regardless. Build a proper virtual directory tree out of the YAML representation, allowing faster search and proper iteration. Besides the crash reproducer, this potentially benefits other VFS clients. llvm-svn: 269327
* [Unittests] Reverse the order of arguments for correct debug outputBruno Cardoso Lopes2016-05-121-1/+1
| | | | llvm-svn: 269326
* clang-format: [JS] respect clang-format off when requoting strings.Martin Probst2016-05-121-0/+8
| | | | | | | | | | Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D20200 llvm-svn: 269282
* Revert "[VFS] Reapply r269100: Reconstruct the VFS overlay tree for more ↵Bruno Cardoso Lopes2016-05-121-29/+1
| | | | | | | | | | accurate lookup" Reverts r269270, buildbots still failing: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/12119 http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/2847 llvm-svn: 269276
* Add an AST matcher for string-literal lengthEtienne Bergeron2016-05-121-1/+11
| | | | | | | | | | | | | | | | Summary: This patch is adding support for a matcher to check string literal length. This matcher is used in clang-tidy checkers and is part of this refactoring: see: http://reviews.llvm.org/D19841 Reviewers: sbenza, klimek, aaron.ballman Subscribers: alexfh, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D19876 llvm-svn: 269274
* [VFS] Reapply r269100: Reconstruct the VFS overlay tree for more accurate lookupBruno Cardoso Lopes2016-05-121-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way we currently build the internal VFS overlay representation leads to inefficient path search and might yield wrong answers when asked for recursive or regular directory iteration. Currently, when reading an YAML file, each YAML root entry is placed inside a new root in the filesystem overlay. In the crash reproducer, a simple "@import Foundation" currently maps to 43 roots, and when looking up paths, we traverse a directory tree for each of these different roots, until we find a match (or don't). This has two consequences: - It's slow. - Directory iteration gives incomplete results since it only return results within one root - since contents of the same directory can be declared inside different roots, the result isn't accurate. This is in part fault of the way we currently write out the YAML file when emitting the crash reproducer - we could generate only one root and that would make it fast and correct again. However, we should not rely on how the client writes the YAML, but provide a good internal representation regardless. This patch builds a proper virtual directory tree out of the YAML representation, allowing faster search and proper iteration. Besides the crash reproducer, this potentially benefits other VFS clients. llvm-svn: 269270
* [VFS][Unittests] Make dir iteration tests depend only on contentBruno Cardoso Lopes2016-05-111-9/+16
| | | | | | | Do not rely on any specific order while comparing the results of directory iteration. llvm-svn: 269234
* [tooling] FixItHint Tooling refactoringEtienne Bergeron2016-05-112-4/+237
| | | | | | | | | | | | | | Summary: This is the refactoring to lift some FixItHint into tooling. used by: http://reviews.llvm.org/D19807 Reviewers: klimek, alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19941 llvm-svn: 269188
* Hopefully bring llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast back to lifeSean Silva2016-05-111-30/+1
| | | | | | | | | Bruno made a couple valiant attempts but the bot is still red. This reverts r269100 (primary commit), r269108 (fix attempt), r269133 (fix attempt). llvm-svn: 269160
OpenPOWER on IntegriCloud