summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* [ASTMatcher] Add hasReplacementType matcher for SubstTemplateTypeParmTypeMalcolm Parsons2016-12-081-0/+17
| | | | | | | | | | | | Summary: Needed for https://reviews.llvm.org/D27166 Reviewers: sbenza, bkramer, klimek Subscribers: aemerson, cfe-commits Differential Revision: https://reviews.llvm.org/D27447 llvm-svn: 289042
* [RecursiveASTVisitor] Improve post-order traversal unit testMalcolm Parsons2016-12-071-4/+4
| | | | llvm-svn: 288976
* [RecursiveASTVisitor] Fix post-order traversal of UnaryOperatorMalcolm Parsons2016-12-071-2/+7
| | | | | | | | | | Reviewers: aaron.ballman, klimek, doug.gregor, teemperor, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26742 llvm-svn: 288923
* CFGBuilder: Fix crash when visiting delete expression on dependent typeMartin Bohme2016-12-051-23/+45
| | | | | | | | | | | | | | Summary: CXXDeleteExpr::getDestroyedType() can return a null QualType if the destroyed type is a dependent type. This patch protects against this. Reviewers: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27350 llvm-svn: 288665
* DR616, and part of P0135R1: member access (or pointer-to-member access) on aRichard Smith2016-12-031-1/+1
| | | | | | | temporary produces an xvalue, not a prvalue. Support this by materializing the temporary prior to performing the member access. llvm-svn: 288563
* [ClangFormat] Only insert #include into the #include block in the beginning ↵Eric Liu2016-12-021-0/+87
| | | | | | | | | | | | | | | | | | of the file. Summary: This avoid inserting #include into: - raw string literals containing #include. - #if block. - Special #include among declarations (e.g. functions). Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D26909 llvm-svn: 288493
* Extend CompilationDatabase by a field for the output filenameJoerg Sonnenberger2016-12-011-1/+7
| | | | | | | | | | | | | | In bigger projects like an Operating System, the same source code is often compiled in slightly different ways. This could be the difference between PIC and non-PIC code for static vs dynamic libraries, it could also be the difference between size optimised versions of tools for ramdisk images. At the moment, the compilation database has no way to distinguish such cases. As first step, add a field in the JSON format for it and process it accordingly. Differential Revision: https://reviews.llvm.org/D27138 llvm-svn: 288436
* Adds hasUnqualifiedDesugaredType to allow matching through type sugar.Manuel Klimek2016-12-011-0/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D27207 llvm-svn: 288366
* clang-format: [JS] Properly format dict literals that skip labels.Daniel Jasper2016-11-291-0/+7
| | | | llvm-svn: 288121
* clang-format: Wrap complex binary expressions on the RHS of a comma.Daniel Jasper2016-11-291-25/+29
| | | | | | | | | Specifically, if the RHS of a comma is a complex binary expression and spans multiple lines, insert a line break before it. This usually is often more readable compared to producing a hanging indent. See changes in FormatTest.cpp for examples. llvm-svn: 288120
* clang-format: Fix unnnecessary line break.Daniel Jasper2016-11-291-0/+6
| | | | | | | | | | | | | | | Before: aaaaaaaaaa(aaaa(aaaa, aaaa), // aaaa, aaaaa); After: aaaaaaaaaa(aaaa(aaaa, aaaa), // aaaa, aaaaa); llvm-svn: 288119
* Avoid lambdas in default member initializers to work around clang bugReid Kleckner2016-11-281-5/+6
| | | | | | | | | | On Windows, Clang is mangling lambdas in default member initializers incorrectly. See PR31197. This is causing redness on the self-host bots. Work around the problem locally so we aren't blind to further issues. llvm-svn: 288089
* [Driver] Add unit tests for Distro detectionMichal Gorny2016-11-282-0/+306
| | | | | | | | | | | | | Add a set of unit tests for the distro detection code. The tests use an in-memory virtual filesystems resembling release files for various distributions supported. All release files are provided (not only the ones directly used) in order to guarantee that one of the rules will not mistakenly recognize the distribution incorrectly due to the additional files (e.g. Ubuntu as Debian). Differential Revision: https://reviews.llvm.org/D25869 llvm-svn: 288062
* Do not do raw name replacement when FromDecl is a class forward-declaration.Eric Liu2016-11-251-2/+42
| | | | | | | | | | | | | | | Summary: If the `FromDecl` is a class forward declaration, the reference is still considered as referring to the original definition given the nature of forward-declarations, so we can't do a raw name replacement in this case. Reviewers: bkramer Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D27132 llvm-svn: 287929
* Consider nested namespaces in the canonical namespace as canonical as well.Eric Liu2016-11-251-0/+8
| | | | | | | | | | | | | | | | | | | | Summary: For example, this case was missed when looking for different but canonical namespaces. UseContext in this case should be considered as in the canonical namespace. ``` namespace a { namespace b { <FromContext> } } namespace a { namespace b { namespace c { <UseContext> } } } ``` Added some commenting. Reviewers: bkramer Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D27125 llvm-svn: 287924
* [ASTImporter] Added ability to import AtomicType nodesGabor Horvath2016-11-231-0/+15
| | | | | | | | Patch by: Kareem Khazem Differential Revision: https://reviews.llvm.org/D26328 llvm-svn: 287763
* Make llvm::Error generated from replacement interfaces more specific.Eric Liu2016-11-221-19/+75
| | | | | | | | | | | | | | | | | Summary: The new error information contains the type of error (e.g. overlap or bad file path) and the replacement(s) that is causing the error. This enables us to resolve some errors. For example, for insertion at the same location conflict, we need to know the existing replacement which conflicts with the new replacement in order to calculate the new position to be insert before/after the existing replacement (for merging). Reviewers: klimek, bkramer Subscribers: djasper, cfe-commits Differential Revision: https://reviews.llvm.org/D26853 llvm-svn: 287639
* [Frontend] Allow attaching an external sema source to compiler instance and ↵Benjamin Kramer2016-11-161-0/+63
| | | | | | | | | | | extra diags to TypoCorrections This can be used to append alternative typo corrections to an existing diag. include-fixer can use it to suggest includes to be added. Differential Revision: https://reviews.llvm.org/D26745 llvm-svn: 287128
* [clang-format] Fixed line merging of more than two linesCameron Desrochers2016-11-151-0/+24
| | | | | | Differential Revision: https://reviews.llvm.org/D19063 llvm-svn: 286973
* clang-format: Support ObjC selectors with unnamed parameters.Daniel Jasper2016-11-121-0/+20
| | | | | | This fixes llvm.org/PR28063. llvm-svn: 286715
* [clang-format] Fix PR30527: Regression when clang-format insert spaces in [] ↵Nico Weber2016-11-101-0/+20
| | | | | | | | | | | | | | | | | | | | when in template Actual regression was introduced in r272668. This revision fixes JS script, but also regress Cpp case. It manifests with spaces added when template is followed with array. Bug 30527 mentions case of array as a nested template type (foo<bar<baz>[]>). Fix is to detect such case and to prevent treating it as array initialization, but as a subscript case. However, before r272668, this case was treated simple because we were detecting it as a StartsObjCMethodExpr. Same was true for other similar case - array of templates (foo<int>[]). This patch tries to address two problems: 1) fixing regression 2) making sure both cases (array as a nested type, array of templates) which were entering StartsObjCMethodExpr branch are handled now appropriately. https://reviews.llvm.org/D26163 Patch from Branko Kokanovic <branko@kokanovic.org>! llvm-svn: 286507
* clang-format: [JS] do not break after declare namespace.Martin Probst2016-11-101-0/+31
| | | | | | | See TypeScript grammar for tokens following 'declare': https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#A.10 llvm-svn: 286467
* Make output of -ast-print a valid C++ code.Serge Pavlov2016-11-102-95/+31
| | | | | | | | | | | | | | | | | | Output generated by option -ast-print looks like C/C++ code, and it really is for plain C. For C++ the produced output was not valid C++ code, but the differences were small. With this change the output is fixed and can be compiled. Tests are changed so that output produced by -ast-print is compiled again with the same flags and both outputs are compared. Option -ast-print is extensively used in clang tests but it itself was tested poorly, existing tests only checked that compiler did not crash. There are unit tests in file DeclPrinterTest.cpp, but they test only terse output mode. Differential Revision: https://reviews.llvm.org/D26452 llvm-svn: 286439
* clang-format: [TypeScript] Fix bug in handling of non-null operator.Daniel Jasper2016-11-091-0/+1
| | | | | | | | | | Before: var i = x!-1; After: var i = x! - 1; llvm-svn: 286367
* [VFS] Replace TimeValue usage with std::chronoPavel Labath2016-11-091-6/+9
| | | | | | | | | | | | Summary: NFCI Reviewers: benlangmuir, zturner Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25948 llvm-svn: 286356
* Add a method to get the list of registered static analyzer checkers.Alexander Kornienko2016-11-081-0/+17
| | | | | | | | | | | | | | Summary: This provides a better interface for clang-tidy and encapsulates the knowledge about experimental checkers instead of leaving this to the clients. Reviewers: zaks.anna Subscribers: a.sidorin, NoQ, dcoughlin, cfe-commits Differential Revision: https://reviews.llvm.org/D26310 llvm-svn: 286218
* Fix memory leak caused by r286096.Eric Liu2016-11-071-6/+6
| | | | llvm-svn: 286132
* Deduplicate replacements by FileEntry instead of file names.Eric Liu2016-11-071-19/+44
| | | | | | | | | | | | | | | Summary: The current version does not deduplicate equivalent file paths correctly. For example, a relative path and an absolute path are considered inequivalent. Comparing FileEnry addresses these issues. Reviewers: djasper Subscribers: alexshap, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D26288 llvm-svn: 286096
* clang-format: Better support for CUDA's triple brackets.Daniel Jasper2016-11-051-0/+2
| | | | | | | | | | | | | Before: aaaaaaaaaaaaaaa< aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaa><<<aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaaaaaa>>>(); After: aaaaaaaaaaaaaaa<aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaa> <<<aaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaaaaaaaaa>>>(); llvm-svn: 286041
* Fixed column shift when formatting line containing bit shift operatorsMalcolm Parsons2016-11-031-0/+12
| | | | | | | | | | | | | | | | | | | Summary: During clang-format source lexing >> and << operators are split and treated as two less/greater operators but column position of following tokens was not adjusted accordingly. Fixes PR26887 Patch by Paweł Żukowski. Reviewers: djasper Subscribers: malcolm.parsons, mprobst, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D25439 llvm-svn: 285934
* Turn on the /bigobj switch for RecursiveASTVisitorTest.cpp; we are now ↵Aaron Ballman2016-11-021-0/+1
| | | | | | bumping up against that limit with MSVC 2015 in Win64 debug build mode. llvm-svn: 285810
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-021-2/+1
| | | | | | | | | | Reviewers: aaron.ballman, mehdi_amini, dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26206 llvm-svn: 285799
* clang-format: Fix bug in function reference qualifier detection.Daniel Jasper2016-11-011-1/+4
| | | | | | | | | | | | | Before: template <typename T> void F(T) && = delete; After: template <typename T> void F(T) && = delete; llvm-svn: 285674
* clang-format: Fix incorrect pointer detection.Daniel Jasper2016-11-011-0/+1
| | | | | | | | | | Before: void f() { f(float{1}, a *a); } After: void f() { f(float{1}, a * a); } llvm-svn: 285673
* clang-format: [JS] Fix incorrect space when "as" is used as identifier.Daniel Jasper2016-11-011-0/+1
| | | | | | | | | | Before: aaaaa.as (); After: aaaaa.as(); llvm-svn: 285672
* clang-format: Fix incorrect binary operator detection.Daniel Jasper2016-11-011-0/+1
| | | | | | | | | | Before: int x = f(* + [] {}); After: int x = f(*+[] {}); llvm-svn: 285671
* clang-format: [JS] Fix formatting of generator functions.Daniel Jasper2016-11-011-0/+5
| | | | | | | | | | | | | | | | | | | Before: var x = { a: function* () { // } } After: var x = { a: function*() { // } } llvm-svn: 285670
* clang-format: [JS] Fix space when for is used as regular identifier.Daniel Jasper2016-11-011-0/+1
| | | | | | | | | | Before: x.for () = 1; After: x.for() = 1; llvm-svn: 285669
* [ASTMatcher] Add CXXNewExpr support to hasDeclarationMalcolm Parsons2016-10-311-0/+6
| | | | | | | | | | Reviewers: sbenza, lukasza, aaron.ballman, klimek Subscribers: lukasza, sbenza, cfe-commits Differential Revision: https://reviews.llvm.org/D26032 llvm-svn: 285644
* Skip over AnnotatedLines with >50 levels of nesting; don't format them.Daniel Jasper2016-10-311-0/+24
| | | | | | | | | | | | | | | Reasoning: - ExpressionParser uses a lot of stack for these, bad in some environments. - Our formatting algorithm is N^3 and gets really slow. - The resulting formatting is unlikely to be any good. - This is probably generated code we're formatting by accident. We treat these as unparseable, and signal incomplete formatting. 50 is an arbitrary number, I've only seen real problems from ~150 levels. Patch by Sam McCall. Thank you. llvm-svn: 285570
* clang-format: [JS] Fix missing space after 'yield'.Daniel Jasper2016-10-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: class X { delete(val) { return null; } * gen() { yield[1, 2]; } * gen() { yield{a: 1}; } }; After: class X { delete(val) { return null; } * gen() { yield [1, 2]; } * gen() { yield {a: 1}; } }; llvm-svn: 285569
* [RecursiveASTVisitor] Visit the implicit expression of a CXXDefaultArgExprMalcolm Parsons2016-10-261-0/+17
| | | | | | | | | | | | | | | | | Summary: The matcher varDecl(hasDescendant( callExpr(hasDeclaration(functionDecl(unless(isNoThrow())))))) didn't match calls from default arguments because the expression for a CXXDefaultArgExpr was not visited. Reviewers: klimek, jdennett, alexfh, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: https://reviews.llvm.org/D25992 llvm-svn: 285239
* Bug 28065 - clang-format incorrectly aligns backslash.Andi-Bogdan Postelnicu2016-10-261-0/+11
| | | | llvm-svn: 285178
* [Sema] Store a SourceRange for multi-token builtin typesMalcolm Parsons2016-10-211-0/+90
| | | | | | | | | | | | | | | | | | | Summary: clang-tidy's modernize-use-auto check uses the SourceRange of a TypeLoc when replacing the type with auto. This was producing the wrong result for multi-token builtin types like long long: -long long *ll = new long long(); +auto long *ll = new long long(); Reviewers: alexfh, hokein, rsmith, Prazek, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25363 llvm-svn: 284885
* clang-format: [JS] Fix template string ASI.Martin Probst2016-10-211-0/+6
| | | | | | | | | | | | | | | | | | | Summary: Previously, automatic semicolon insertion would add an unwrapped line when a template string contained a line break. var x = `foo${ bar}`; Would be formatted with `bar...` on a separate line and no indent. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D25675 llvm-svn: 284807
* [Format] Cleanup after replacing constructor body with = defaultMalcolm Parsons2016-10-201-0/+18
| | | | | | | | | | | | | | Summary: Remove colon and commas after replacing constructor body with = default. Fix annotation of TT_CtorInitializerColon when preceded by a comment. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D25768 llvm-svn: 284732
* Try to fix windows bot file path style failure caused by r284219.Eric Liu2016-10-141-0/+18
| | | | llvm-svn: 284222
* Deduplicate sets of replacements by file names.Eric Liu2016-10-141-0/+18
| | | | | | | | | | | | | | | Summary: If there are multiple <File, Replacements> pairs with the same file path after removing dots, we only keep one pair (with path after dots being removed) and discard the rest. Reviewers: djasper Subscribers: klimek, hokein, bkramer, cfe-commits Differential Revision: https://reviews.llvm.org/D25565 llvm-svn: 284219
* Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)Mehdi Amini2016-10-111-8/+8
| | | | llvm-svn: 283856
* Store FileEntry::Filename as a StringRef instead of raw pointer (NFC)Mehdi Amini2016-10-101-2/+2
| | | | llvm-svn: 283815
OpenPOWER on IntegriCloud