summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* Make RecursiveASTVisitor visit lambda capture initialization expressionsMartin Bohme2016-08-011-0/+8
| | | | | | | | | | | | | | | | | | | | | Summary: Lambda capture initializations are part of the explicit source code and therefore should be visited by default but, so far, RecursiveASTVisitor does not visit them. This appears to be an oversight. Because the lambda body needs custom handling (calling TraverseLambdaBody()), the DEF_TRAVERSE_STMT for LambdaExpr sets ShouldVisitChildren to false but then neglects to visit the lambda capture initializations. This patch adds code to visit the expressions associated with lambda capture initializations. Reviewers: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22566 llvm-svn: 277342
* Implement tooling::Replacements as a class.Eric Liu2016-08-015-327/+328
| | | | | | | | | | | | | | | | | | | Summary: - Implement clang::tooling::Replacements as a class to provide interfaces to control how replacements for a single file are combined and provide guarantee on the order of replacements being applied. - tooling::Replacements only contains replacements for the same file now. Use std::map<std::string, tooling::Replacements> to represent multi-file replacements. - Error handling for the interface change will be improved in followup patches. Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D21748 llvm-svn: 277335
* [ASTMatcher] Add templateName matcher.Haojian Wu2016-07-291-0/+8
| | | | | | | | | | Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D22963 llvm-svn: 277155
* [ASTMatcher] Add hasTemplateArgument/hasAnyTemplateArgument support in ↵Haojian Wu2016-07-291-0/+13
| | | | | | | | | | | | functionDecl. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D22957 llvm-svn: 277142
* clang-format: Fix incorrect detection of QT-signals access specifier.Daniel Jasper2016-07-271-0/+4
| | | | | | | | | | | | | | | | | Before: void f() { label: signals .baz(); } After: void f() { label: signals.baz(); } llvm-svn: 276854
* Revert "Make RecursiveASTVisitor visit lambda capture initialization ↵Martin Bohme2016-07-261-8/+0
| | | | | | | | | | expressions" This reverts commit r276755. (Broke clang-tidy check modernize-loop-convert.) llvm-svn: 276759
* Make RecursiveASTVisitor visit lambda capture initialization expressionsMartin Bohme2016-07-261-0/+8
| | | | | | | | | | | | | | | Summary: Lambda capture initializations are part of the explicit source code and therefore should be visited by default but, so far, RecursiveASTVisitor does not visit them. This appears to be an oversight. Because the lambda body needs custom handling (calling TraverseLambdaBody()), the DEF_TRAVERSE_STMT for LambdaExpr sets ShouldVisitChildren to false but then neglects to visit the lambda capture initializations. This patch adds code to visit the expressions associated with lambda capture initializations. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D22566 llvm-svn: 276755
* [Tooling] skip anonymous namespaces when checking if typeLoc references a ↵Eric Liu2016-07-261-0/+8
| | | | | | | | | | | | | | | | type decl from a different canonical namespace. Summary: [Tooling] skip anonymous namespaces when checking if typeLoc references a type decl from a different canonical namespace. Reviewers: bkramer Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D22808 llvm-svn: 276754
* [NFC] Header cleanupMehdi Amini2016-07-1814-14/+8
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* clang-format: [JS] Allow top-level conditionals again.Daniel Jasper2016-07-121-1/+1
| | | | | | | | I am not sure exactly which test breakage Martin was trying to fix in r273694. For now, fix the behavior for top-level conditionals, which (surprisingly) are actually used somewhat commonly. llvm-svn: 275183
* [ASTMatchers] isSignedInteger() and isUnsignedInteger()Clement Courbet2016-07-121-0/+12
| | | | | | | | Complementary to isInteger(), these match signed and unsigned integers respectively. Review: http://reviews.llvm.org/D21989 llvm-svn: 275157
* Make tooling::applyAllReplacements return llvm::Expected<string> instead of ↵Eric Liu2016-07-1110-53/+83
| | | | | | | | | | | | | | | | empty string to indicate potential error. Summary: return llvm::Expected<> to carry error status and error information. This is the first step towards introducing "Error" into tooling::Replacements. Reviewers: djasper, klimek Subscribers: ioeric, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D21601 llvm-svn: 275062
* clang-format: [JS] Sort imports case insensitive.Martin Probst2016-07-091-0/+21
| | | | | | | | | | | | Summary: ASCII case sorting does not help finding imported symbols quickly, and it is common to have e.g. class Foo and function fooFactory exported/imported from the same file. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D22146 llvm-svn: 274977
* clang-format: [JS] support trailing commas in imports.Martin Probst2016-07-091-0/+4
| | | | | | | | | | Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D22147 llvm-svn: 274976
* CFGTests: Update libdeps.NAKAMURA Takumi2016-07-081-0/+3
| | | | llvm-svn: 274885
* clang/unittests/Analysis/CFGTest.cpp: Appease msc targets with ↵NAKAMURA Takumi2016-07-081-1/+1
| | | | | | -fno-delayed-template-parsing. llvm-svn: 274879
* CFGBuilder: Fix crash when visiting a range-based for over a dependent typeAlexander Kornienko2016-07-083-0/+72
| | | | | | | | | | | | | | | | | Summary: CFG generation is expected to fail in this case, but it should not crash. Also added a test that reproduces the crash. Reviewers: klimek Subscribers: cfe-commits Patch by Martin Boehme! Differential Revision: http://reviews.llvm.org/D21895 llvm-svn: 274834
* Recommit r274348 and r274349. The Windows failures should be fixed.Vassil Vassilev2016-07-082-0/+124
| | | | | | | | | | | | | | Original commit message: "Add postorder traversal support to the RecursiveASTVisitor. This feature needs to be explicitly enabled by overriding shouldTraversePostOrder() as it has performance drawbacks for the iterative Stmt-traversal. Patch by Raphael Isemann! Reviewed by Richard Smith and Benjamin Kramer." llvm-svn: 274830
* Add AST matchers for handling bit-fields and narrowing based on their width.Aaron Ballman2016-07-061-0/+8
| | | | llvm-svn: 274652
* [ASTMatchers] New forEachOverriden matcher.Clement Courbet2016-07-051-0/+44
| | | | | | Matches methods overridden by the given method. llvm-svn: 274531
* Revert r274348 and r274349 until the Windows failures are fixed.Vassil Vassilev2016-07-012-124/+0
| | | | llvm-svn: 274359
* Add forgotten test to r274348.Vassil Vassilev2016-07-011-0/+123
| | | | llvm-svn: 274349
* Add postorder traversal support to the RecursiveASTVisitor.Vassil Vassilev2016-07-011-0/+1
| | | | | | | | | | | This feature needs to be explicitly enabled by overriding shouldTraversePostOrder() as it has performance drawbacks for the iterative Stmt-traversal. Patch by Raphael Isemann! Reviewed by Richard Smith and Benjamin Kramer. llvm-svn: 274348
* Fix ASTMatchersNodeTest to work on Windows.Justin Lebar2016-06-301-7/+5
| | | | | | | | | | | It was failing because it had an explicit check for whether we're on Windows. There are a few other similar explicit checks in this file which I didn't remove because they serve as reasonable documentation that the test doesn't work with a Windows triple. llvm-svn: 274269
* Don't instantiate a full host toolchain in ASTMatchersTest.Justin Lebar2016-06-301-15/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This test was stat()'ing large swaths of /usr/lib hundreds of times, as every invocation of matchesConditionally*() created a new Linux toolchain. In addition to being slow, perf indicated this was causing substantial contention in the kernel. Something is...interesting in the kernel, as without this patch I sometimes see ~11m spent in the kernel, and sometimes ~5m. This corresponds to bimodal ninja check-clang times of ~30s and ~20s. It's not clear to me exactly what causes the bimodality. In any case, this change makes this test run in 2.5s, down from 17s, and it seems to cause us to get the 20s ninja check-clang time unconditionally. Reviewers: chandlerc Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D21810 llvm-svn: 274257
* [ASTMatcher] Add a node matcher for EnumType.Haojian Wu2016-06-301-0/+7
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D21860 llvm-svn: 274217
* [Tooling] Add optional argument to getFullyQualifiedName to prepend "::".Siva Chandra2016-06-291-1/+39
| | | | | | | | | | Reviewers: rsmith, saugustine, rnk Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D21666 llvm-svn: 274185
* [ASTMatchers] Add isLambda() matcher.Samuel Benzaquen2016-06-281-0/+6
| | | | llvm-svn: 274015
* clang-format: [JS] Fix build breakage.Martin Probst2016-06-241-1/+1
| | | | | | Checking Line.MustBeDeclaration does actually break the field and param initializer use case. llvm-svn: 273694
* IgnoringImplicit matcher.Cong Liu2016-06-241-0/+10
| | | | llvm-svn: 273659
* clang-format: [JS] handle conditionals in fields, default params.Martin Probst2016-06-231-1/+9
| | | | | | | | | | | | Summary: Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D21658 llvm-svn: 273619
* clang-format: [JS] recognize more type locations.Martin Probst2016-06-231-0/+6
| | | | | | | | | | | | Summary: Includes parenthesized type expressions and type aliases. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D21597 llvm-svn: 273603
* clang-format: [Proto] Use more compact format for text-formatted optionsDaniel Jasper2016-06-231-5/+5
| | | | | | | | | | | | | | | | | Before: enum Type { UNKNOWN = 0 [(some_options) = { a: aa, b: bb }]; }; After: enum Type { UNKNOWN = 0 [(some_options) = {a: aa, b: bb}]; }; llvm-svn: 273553
* clang-format: [JS] Do not break before 'as'.Martin Probst2016-06-221-2/+5
| | | | | | | | | | | | | | Summary: 'as' is a pseudo operator, so automatic semicolon insertion kicks in and the code fails to part. Reviewers: djasper Subscribers: klimek Differential Revision: http://reviews.llvm.org/D21576 llvm-svn: 273422
* Re-commit "[Temporary] Add an ExprWithCleanups for each C++ ↵Tim Shen2016-06-211-2/+2
| | | | | | | | | | MaterializeTemporaryExpr." Since D21243 fixes relative clang-tidy tests. This reverts commit a71d9fbd41e99def9159af2b01ef6509394eaeed. llvm-svn: 273312
* Added calculateRangesAfterReplaments() to calculate affacted ranges in the ↵Eric Liu2016-06-211-4/+87
| | | | | | | | | | | | | | | | new code. Summary: Added calculateRangesAfterReplaments() to calculate original ranges as well as newly affacted ranges in the new code. Reviewers: klimek, djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D21547 llvm-svn: 273290
* clang-format: [Proto] Fix "import public" after r273179.Daniel Jasper2016-06-201-0/+6
| | | | llvm-svn: 273196
* clang-format: [Proto] Don't do bad things if imports are missing ;.Daniel Jasper2016-06-201-0/+15
| | | | llvm-svn: 273179
* ToolingTests/runToolOnCode.TestSkipFunctionBody: Appease msc targets.NAKAMURA Takumi2016-06-171-3/+4
| | | | llvm-svn: 272985
* Fix a few issues while skipping function bodiesOlivier Goffart2016-06-161-1/+55
| | | | | | | | | | | | | | | | | | | | - In functions with try { } catch { }, only the try block would be skipped, not the catch blocks - The template functions would still be parsed. - The initializers within a constructor would still be parsed. - The inline functions within class would still be stored, only to be discared later. - Invalid code with try would assert (as in "int foo() try assert_here") This attempt to do even less while skipping function bodies. Differential Revision: http://reviews.llvm.org/D20821 llvm-svn: 272963
* [clang-format] do not add existing includes.Eric Liu2016-06-141-0/+23
| | | | | | | | | | | | Summary: do not add existing includes. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D21323 llvm-svn: 272669
* clang-format: [JS] Fix failing format with TypeScript casts.Daniel Jasper2016-06-141-0/+4
| | | | | | | | | | | | Before, this could be formatted at all (with BracketAlignmentStyle AlwaysBreak): foo = <Bar[]>[ 1, /* */ 2 ]; llvm-svn: 272668
* clang-format: [JS] Support annotated classes.Daniel Jasper2016-06-141-0/+5
| | | | llvm-svn: 272654
* clang-format: [JS] Indent namespaces in JavaScript/TS by default.Martin Probst2016-06-131-0/+9
| | | | | | | | | | | | Summary: There's no convention of avoiding the nested indentation. Reviewers: djasper Subscribers: klimek, alexeagle, cfe-commits Differential Revision: http://reviews.llvm.org/D21275 llvm-svn: 272559
* clang-format: [JS] Introduce JavaScriptWrapImports option.Martin Probst2016-06-132-7/+28
| | | | | | | | | | | | | | Summary: When turned on, clang-format wraps JavaScript imports (and importing exports), instead of forcing the entire import statement onto one line. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D21273 llvm-svn: 272558
* clang-format: Restrict r272537 to function ref qualifiers.Daniel Jasper2016-06-131-0/+1
| | | | | | | | | | | | Seems this isn't generally desirable. Before: int const * a; After: int const* a; llvm-svn: 272548
* clang-format: Fix incorrect function type detection.Daniel Jasper2016-06-131-0/+1
| | | | | | | | | | Before: returnsFunction (&param1, &param2)(param); After: returnsFunction(&param1, &param2)(param); llvm-svn: 272538
* clang-format: Don't merge const and &, e.g. in function ref qualifiers.Daniel Jasper2016-06-131-0/+2
| | | | | | | | | | | | | | | | | Before (when aligning & to the right): SomeType MemberFunction(const Deleted &) const&; After: SomeType MemberFunction(const Deleted &) const &; This also applies to variable declarations, e.g.: int const * a; However, this form is very uncommon (most people would write "const int* a" instead) and contracting to "const*" might actually send the wrong signal of what the const binds to. llvm-svn: 272537
* clang-format: Fix incorrect cast detection.Daniel Jasper2016-06-131-0/+1
| | | | | | | | | | Before: auto s = sizeof...(Ts)-1; After: auto s = sizeof...(Ts) - 1; llvm-svn: 272536
* clang-format: Don't indent lambda body relative to its return type.Daniel Jasper2016-06-131-0/+4
| | | | | | | | | | | | | | | | Before: []() // -> int { return 1; // }; After: []() // -> int { return 1; // }; llvm-svn: 272535
OpenPOWER on IntegriCloud