summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: Fix formatting of ternary expressions with comments.Daniel Jasper2016-02-031-0/+4
| | | | | | | | | | | | | | Before: int i = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? /*bbbbbbbbbbbbbbbbbbbb=*/bbbbbbbbbbbbbbbbbbbbbbbbb : ccccccccccccccccccccccccccc; After: int i = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? /*bbbbbbbbbbbbbbbbbbbb=*/bbbbbbbbbbbbbbbbbbbbbbbbb : ccccccccccccccccccccccccccc; llvm-svn: 259670
* Provide match function to look over an entire TU again.Daniel Jasper2016-02-031-1/+9
| | | | llvm-svn: 259648
* clang-format: [JS/TypeScript] Support "enum" as an optional property name, too.Daniel Jasper2016-02-031-0/+1
| | | | | | | | | | | Before: enum?: string []; After: enum?: string[]; llvm-svn: 259628
* clang-format: Make AlignAfterOpenBracket also affect angle brackets.Daniel Jasper2016-02-021-0/+9
| | | | | | Patch by Matthew Whitehead, thank you. llvm-svn: 259487
* Always build a new TypeSourceInfo for function templates with parametersNico Weber2016-02-011-0/+11
| | | | | | | | | | | | | | | | | | | | | RecursiveASTVisitor::TraverseFunctionHelper() traverses a function's ParmVarDecls by going to the function's getTypeSourceInfo if it exists, and `DEF_TRAVERSE_TYPELOC(FunctionProtoType` then goes to the function's ParmVarDecls. For a function template that doesn't have parameters that explicitly depend on the template parameter, we used to be clever and not build a new TypeSourceInfo. That meant that when an instantiation of such a template is visited, its TypeSourceInfo would point to the ParmVarDecls of the template, not of the instantiation, which then confused clients of RecursiveASTVisitor. So don't be clever for function templates that have parameters, even if none of the parameters depend on the type. Fixes PR26257. http://reviews.llvm.org/D16478 llvm-svn: 259428
* Reapply r259210 with a fix for RegistryTest.cpp.Aaron Ballman2016-02-012-2/+26
| | | | | | Patch by Richard Thomson. llvm-svn: 259359
* clang-format: Fix incorrect pointer detection in lambdas in constructorDaniel Jasper2016-02-011-0/+1
| | | | | | | | | | | | initializers. Before: Constructor() : member([](A *a, B * b) {}) {} After: Constructor() : member([](A *a, B *b) {}) {} llvm-svn: 259353
* clang-format: Add option to disable string literal formatting.Daniel Jasper2016-02-011-0/+6
| | | | llvm-svn: 259352
* clang-format: Fix alignment of trailing multiline columns.Daniel Jasper2016-02-011-0/+8
| | | | llvm-svn: 259351
* clang-format: [JS] Treat "in" as a proper operator.Daniel Jasper2016-02-011-0/+11
| | | | llvm-svn: 259350
* Revert r259210 "Extend hasType narrowing matcher for TypedefDecls, add ↵Hans Wennborg2016-01-291-25/+1
| | | | | | | | functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes." It didn't pass check-clang. llvm-svn: 259218
* Extend hasType narrowing matcher for TypedefDecls, add functionProtoType ↵Aaron Ballman2016-01-291-1/+25
| | | | | | | | matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes. Patch by Richard Thomson llvm-svn: 259210
* Add an optional ToolName argument to ↵Benjamin Kramer2016-01-291-3/+3
| | | | | | | | | | runToolOnCodeWithArgs/buildASTFromCodeWithArgs. This can be used as a way to modify argv[0] for a clang tool. Differential Revision: http://reviews.llvm.org/D16718 llvm-svn: 259187
* Include RecordDecls from anonymous unions in the AST.Nico Weber2016-01-281-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For void f() { union { int i; }; } clang used to omit the RecordDecl from the anonymous union from the AST. That's because the code creating it only called PushOnScopeChains(), which adds it to the current DeclContext, which here is the function's DeclContext. But RecursiveASTVisitor doesn't descent into all decls in a FunctionDecl. Instead, for DeclContexts that contain statements, return the RecordDecl so that it can be included in the DeclStmt containing the VarDecl for the union. Interesting bits from the AST before this change: |-FunctionDecl | `-CompoundStmt | |-DeclStmt | | `-VarDecl 0x589cd60 <col:3> col:3 implicit used 'union (anonymous at test.cc:3:3)' callinit After this change: -FunctionDecl | `-CompoundStmt | |-DeclStmt | | |-CXXRecordDecl 0x4612e48 <col:3, col:18> col:3 union definition | | | |-FieldDecl 0x4612f70 <col:11, col:15> col:15 referenced i 'int' | | `-VarDecl 0x4613010 <col:3> col:3 implicit used 'union (anonymous at test.cc:3:3)' callinit This is now closer to how anonymous struct and unions are represented as members of structs. It also enabled deleting some one-off code in the template instantiation code. Finally, it fixes a crash with ASTMatchers, see the included test case (this fixes http://crbug.com/580749). llvm-svn: 259079
* clang-format: [Java] Remove unnecessary line break after complex annotationsDaniel Jasper2016-01-271-0/+3
| | | | | | | | | | | | | | | Before: @Annotation("Some" + " text") List<Integer> list; After: @Annotation("Some" + " text") List<Integer> list; llvm-svn: 258981
* Remove autoconf supportChris Bieneman2016-01-2615-312/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
* Fix Clang-tidy modernize-use-nullptr warnings; other minor fixes.Eugene Zelenko2016-01-261-2/+1
| | | | | | Differential revision: http://reviews.llvm.org/D16567 llvm-svn: 258836
* Add am AST matcher for isMoveAssignmentOperator.Aaron Ballman2016-01-221-0/+15
| | | | | | Patch by Jonathan Coe. llvm-svn: 258573
* Let RecursiveASTVisitor visit array index VarDeclsNico Weber2016-01-222-0/+27
| | | | | | | | | | | | An implicit copy ctor creates loop VarDecls that hang off CXXCtorInitializer. RecursiveASTVisitor used to not visit them, so that they didn't show up in the parent map used by ASTMatchers, causing asserts() when the implicit DeclRefExpr() in a CXXCtorInitializer referred to one of these VarDecls. Fixes PR26227. http://reviews.llvm.org/D16413 llvm-svn: 258503
* Replace some tabs with spaces.Nico Weber2016-01-221-4/+3
| | | | llvm-svn: 258500
* Add an isVirtualAsWritten AST matcher.Nico Weber2016-01-211-0/+10
| | | | | | http://reviews.llvm.org/D16394 llvm-svn: 258415
* Add AST matcher support for FunctionDecls with the hasBody matcher.Aaron Ballman2016-01-202-1/+5
| | | | | | Patch by Aleksei Sidorin. llvm-svn: 258322
* Add AST matcher for paren expressions.Aaron Ballman2016-01-202-0/+14
| | | | | | Patch by Adrian Zgorzałek. llvm-svn: 258321
* Fix formatting of fully qualified names in array subscripts.Manuel Klimek2016-01-191-0/+1
| | | | | | | | | | Before: a[ ::b::c]; After: a[::b::c]; llvm-svn: 258123
* The destructor name should be matched to ~Foo instead of Foo.Aaron Ballman2016-01-181-3/+3
| | | | llvm-svn: 258077
* Add an AST matcher for checking whether a function is defaulted.Aaron Ballman2016-01-181-0/+7
| | | | | | Patch by Jonathan Coe. llvm-svn: 258072
* Augments r258042; changes the AST matcher tests to use matchesNot and ↵Aaron Ballman2016-01-181-2/+14
| | | | | | EXPECT_TRUE instead of EXPECT_FALSE. Adds a matcher test to ensure that static member functions are properly handled. Generates the documentation from the matcher. llvm-svn: 258070
* Add forEachArgumentWithParam AST matcher.Manuel Klimek2016-01-181-0/+85
| | | | | | | | | | | | The new matcher allows users to provide a matcher for both the argument of a CallExpr/CxxConstructExpr a well as the ParmVarDecl of the argument. Patch by Felix Berger. Differential Revision: http://reviews.llvm.org/D13845 llvm-svn: 258042
* clang-format: Fix incorrectly enforced linebreak with ColumnLimit 0.Daniel Jasper2016-01-141-0/+3
| | | | | | | | | | | Before: aaaa[bbbb] .cccc(); After: aaaa[bbbb].cccc(); llvm-svn: 257763
* clang-format: [JS] Fix incorrect line break leading to semicolon insertion.Daniel Jasper2016-01-141-0/+4
| | | | | | | | | | | | | | | | clang-format only works for JavaScript code, if all the semicolons are present anyway, so this linebreak can never be desired. Before (with appropriate statement lengths or column limit): return [ aaa ]; After: return [ aaaa ]; llvm-svn: 257741
* clang-format: [ObjC+JS] Allow bin-packing of array literals.Daniel Jasper2016-01-132-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After reading the style guides again, they don't actually say how to pack or not pack array literals. Based on some user reports, array initializers can unnecessarily get quite long if they contain many small elements. Array literals with trailing commas are still formatted one per line so that users have a way to opt out of the packing. Before: var array = [ aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa ]; After: var array = [ aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa ]; llvm-svn: 257615
* Properly track the end location of an exception specification.Aaron Ballman2016-01-121-0/+38
| | | | | | Patch by Adrian Zgorzałek llvm-svn: 257521
* clang-format: [JS] Support exporting abstract classes.Daniel Jasper2016-01-121-0/+1
| | | | | | | | | | | 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-0/+4
| | | | llvm-svn: 257406
* [clang-format] Fix comment aligning when there are changes within the commentBenjamin Kramer2016-01-111-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | As soon as a comment had whitespace changes inside of the token, we couldn't identify the whole comment as a trailing comment anymore and alignment stopped working. Add a new boolean to Change for this special case and fix trailing comment identification to use it. This also changes WhitespaceManager to sum the length of all Changes inside of a token into the first Change. Before this fix int xy; // a int z; //b became int xy; // a int z; // b with this patch we immediately get to: int xy; // a int z; // b Differential Revision: http://reviews.llvm.org/D16058 llvm-svn: 257341
* clang-format: Fix overloading "operator," definitions more thoroughly.Daniel Jasper2016-01-111-1/+1
| | | | | | | | | | | Before: aaaaaaaaaaaaaaaaaaaaaa operator,(aaaaaaaaaaaaaaaaaaaaa & aaaaaaaaaaaaaaaaaaaaaaaaaa) const; After: aaaaaaaaaaaaaaaaaaaaaa operator,( aaaaaaaaaaaaaaaaaaaaa &aaaaaaaaaaaaaaaaaaaaaaaaaa) const; llvm-svn: 257330
* clang-format: Slightly row back on r257257.Daniel Jasper2016-01-111-0/+13
| | | | | | | | | | | | | | | | | | | | | r257257 change the way clang-format enforces line breaks after a templated type has been line-wrapped. This was to fix an incorrect line break if BinPackParameters is set to false. However, it also leads to an unwanted line break in a different case. Thus, for now, only do this when BinPackParameters is false. This isn't ideal yet, but helps us until we have a better solution. With BinPackParameters: Before: void fffffffffff(aaaaaaaaaaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaa> aaaaaaaaaa); After: void fffffffffff( aaaaaaaaaaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaa> aaaaaaaaaa); llvm-svn: 257325
* clang-format: [JS] Improve line-flow when calling functions on array literals.Daniel Jasper2016-01-111-0/+6
| | | | | | | | | | | | | | | | | | | Before: return [ aaaaaaaaaaaaaaaaaaaaaa ].aaaaaaa(function() { // }) .bbbbbb(); After: return [aaaaaaaaaaaaaaaaaaaaaa] .aaaaaaa(function() { // }) .bbbbbb(); llvm-svn: 257324
* Simplify test code with initializer lists.Benjamin Kramer2016-01-101-47/+16
| | | | | | No functional change intended. llvm-svn: 257287
* Make test work on windows by turning \ in paths back into /.Benjamin Kramer2016-01-101-2/+8
| | | | llvm-svn: 257286
* clang-format: Fix the counting of leading whitespace in tok::unknown tokensDaniel Jasper2016-01-091-0/+3
| | | | | | | | Previously, all whitespace characters would increase the starting column, which doesn't make sense. This fixes a problem, e.g. with the length calculation in JS template strings. llvm-svn: 257267
* [vfs] Normalize working directory if requested.Benjamin Kramer2016-01-091-0/+6
| | | | | | | | FixedCompilationDatabase sets the working dir to "." by default. For chdir(".") this is a noop but this lead to InMemoryFileSystem to create bogus paths. Fixes PR25327. llvm-svn: 257260
* clang-format: Improve selective comment formatting.Daniel Jasper2016-01-091-0/+7
| | | | | | | | | | | | | | | | | | | Starting here: int x; // Format this line only. int xx; // int xxxxx; // Before: int x; // Format this line only. int xx; // int xxxxx; // After: int x; // Format this line only. int xx; // int xxxxx; // llvm-svn: 257258
* clang-format: Fix incorrect line break in certain configurations.Daniel Jasper2016-01-091-0/+4
| | | | | | | | | | | | | Before: void aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, vector<int> bbbbbbbbbbbbbbb); After: void aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, vector<int> bbbbbbbbbbbbbbb); llvm-svn: 257257
* clang-format: Support definitions/declarations of operator,.Daniel Jasper2016-01-091-0/+3
| | | | | | | | | | Before: bool operator, (); After: bool operator,(); llvm-svn: 257256
* clang-format: [JS] Support semicolons in TypeScript's TypeMemberLists.Daniel Jasper2016-01-091-0/+8
| | | | | | | | | | | | | | Before: var x: { a: string; b: number; } = {}; After: var x: {a: string; b: number;} = {}; llvm-svn: 257255
* clang-format: [JS] Prefer wrapping before the TypeScript return typeDaniel Jasper2016-01-081-0/+3
| | | | | | | | | | | | | | over wrapping before parameters. Before: function someFunc( args: string[]): {longReturnValue: string[]} {} After: function someFunc(args: string[]): {longReturnValue: string[]} {} llvm-svn: 257162
* clang-format: [JS] Add some Closure Compiler JSDoc tags to the defaultDaniel Jasper2016-01-081-0/+10
| | | | | | Google configuration so that they aren't line-wrapped. llvm-svn: 257159
* clang-format: [JS] Support more ES6 classes.Daniel Jasper2016-01-081-0/+6
| | | | | | | | | | | | | | | Before: foo = class { constructor() {} } ; After: foo = class { constructor() {} }; llvm-svn: 257154
* clang-format: Fix corner case in one-per-line formatting.Daniel Jasper2016-01-072-0/+13
| | | | | | | | | | | | | | | | | | | Before (example is JS, but also applies to C++): return [ aaaa() .bbbbbbbb('A'), aaaa().bbbbbbbb('B'), aaaa().bbbbbbbb('C'), ]; After: return [ aaaa().bbbbbbbb('A'), aaaa().bbbbbbbb('B'), aaaa().bbbbbbbb('C'), ]; llvm-svn: 257079
OpenPOWER on IntegriCloud