summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
* Make clang-format remove duplicate headers when sorting #includes.Eric Liu2016-08-101-6/+83
| | | | | | | | | | | | Summary: When sorting #includes, #include directives that have the same text will be deduplicated when sorting #includes, and only the first #include in the duplicate #includes remains. If the `Cursor` is provided and put on a deleted #include, it will be put on the remaining #include in the duplicate #includes. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D23274 llvm-svn: 278206
* [ASTMatchers] Add matchers canReferToDecl() and hasUnderlyingDecl()Martin Bohme2016-08-091-0/+34
| | | | | | | | | | | | Summary: Required for D22220 Reviewers: sbenza, klimek, aaron.ballman, alexfh Subscribers: alexfh, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D23004 llvm-svn: 278123
* clang-format: Add SpaceAfterTemplateSylvestre Ledru2016-08-091-0/+7
| | | | | | | | | | | | | | | | Summary: This is required for compliance with the Mozilla style guide. This is a rebase+minor change of Birunthan Mohanathas's patch Reviewers: djasper Subscribers: klimek, cfe-commits, opilarium Differential Revision: https://reviews.llvm.org/D23317 llvm-svn: 278121
* Fixes calculateRangesAfterReplacements crash when Replacements is empty.Eric Liu2016-08-081-0/+7
| | | | | | | | | | Reviewers: klimek, djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D23264 llvm-svn: 278004
* Make isExternC work on VarDecls too.Benjamin Kramer2016-08-041-0/+6
| | | | llvm-svn: 277712
* Fix bug in conflict check for Replacements::add().Manuel Klimek2016-08-031-0/+20
| | | | | | | We would not detect conflicts when inserting insertions at the same offset as previously contained replacements. llvm-svn: 277603
* Fix quadratic runtime when adding items to tooling::Replacements.Manuel Klimek2016-08-031-0/+42
| | | | | | | | | | | Previously, we would search through all replacements when inserting a new one to check for overlaps. Instead, make use of the fact that we already have a set of replacments without overlaps to find the potential overlap with lower_bound. Differential Revision: https://reviews.llvm.org/D23119 llvm-svn: 277597
* [CUDA] Do not allow using NVPTX target for host compilation.Artem Belevich2016-08-021-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D23042 llvm-svn: 277537
* 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
OpenPOWER on IntegriCloud