summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
* clang-format: Basic support for Java.Daniel Jasper2014-09-152-0/+70
| | | | llvm-svn: 217759
* clang-format: Add option to break before non-assignment operators.Daniel Jasper2014-09-151-5/+28
| | | | | | | | | This will allow: int aaaaaaaaaaaaaa = bbbbbbbbbbbbbb + ccccccccccccccc; llvm-svn: 217757
* clang-format: Improve line breaks at function calls.Daniel Jasper2014-09-121-0/+5
| | | | | | | | | | | | | Before: EXPECT_CALL(SomeObject, SomeFunction(Parameter)).Times(2).WillRepeatedly( Return(SomeValue)); After: EXPECT_CALL(SomeObject, SomeFunction(Parameter)) .Times(2) .WillRepeatedly(Return(SomeValue)); llvm-svn: 217687
* Fix bug 20892 - clang-format does not handle C-style commentsRoman Kashitsyn2014-09-111-0/+10
| | | | | | | | | | | | | | | | | | | | | | Summary: http://llvm.org/bugs/show_bug.cgi?id=20892 Add support of C-style formatting enabling/disabling directives. Now the following two styles are supported: // clang-format on /* clang-format on */ The flexibility in comments (support of extra spaces and/or slashes, etc.) is deliberately avoided to simplify search in large code bases. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, curdeius, klimek Differential Revision: http://reviews.llvm.org/D5309 llvm-svn: 217588
* clang-format: Add option to allow short case labels on a single line.Daniel Jasper2014-09-101-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | On a single line: switch (a) { case 1: x = 1; return; case 2: x = 2; return; default: break; } Not on a single line: switch (a) { case 1: x = 1; return; case 2: x = 2; return; default: break; } This partly addresses llvm.org/PR16535. In the long run, we probably want to lay these out in columns. llvm-svn: 217501
* Revert over-eager unique_ptr conversion.Benjamin Kramer2014-09-101-6/+6
| | | | | | | This test wants to observe PPCallbacks after they have been moved into the preprocessor. That doesn't work if the pointer has been moved away. llvm-svn: 217481
* Unique_ptrify PPCallbacks ownership.Craig Topper2014-09-104-10/+10
| | | | | | Unique_ptr creation stil needs to be moved earlier at some of the call sites. llvm-svn: 217474
* clang-format: [JS] Support regex literals with trailing escaped slash.Daniel Jasper2014-09-091-0/+2
| | | | | | | | | | | | | | | | | | Before: var regex = / a\//; int i; After: var regex = /a\//; int i; This required pushing the Lexer into its wrapper class and generating a new one in this specific case. Otherwise, the sequence get lexed as a //-comment. This is hacky, but I don't know a better way (short of supporting regex literals in the Lexer). Pushing the Lexer down seems to make all the call sites simpler. llvm-svn: 217444
* Tooling: Ignore file names in tooling::deduplicate.Benjamin Kramer2014-09-091-2/+6
| | | | | | | | | | | This was horribly broken due to how the sort predicate works. We would report a conflict for files with a replacement in the same position but different names if the length differed. Just ignore paths as this is often what the user wants. Files can occur with different names (due to symlinks or relative paths) and we don't ever want to do the same edit in one file twice. llvm-svn: 217439
* clang-format: [JS] Format embedded function literals more efficently.Daniel Jasper2014-09-051-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: return { a: a, link: function() { f(); // }, link: function() { f(); // } }; After: return { a: a, link: function() { f(); // }, link: function() { f(); // } }; llvm-svn: 217238
* clang-format: [JS] JavaScript does not have the */&/&& madness.Daniel Jasper2014-09-051-0/+4
| | | | | | | | | | | | | Before: e&& e.SomeFunction(); After: e && e.SomeFunction(); Yeah, this might be useful for C++, too, but it is not such a frequent pattern there (plus the fix is much harder). llvm-svn: 217237
* clang-format: [JS] Better support for empty function literals.Daniel Jasper2014-09-051-0/+1
| | | | | | | | | | Before: SomeFunction(function(){}); After: SomeFunction(function() {}); llvm-svn: 217236
* clang-format: [JS] Fix indentation in dict literals.Daniel Jasper2014-09-051-0/+5
| | | | | | | | | | | | | | | | | | Before: return { 'finish': // a }; After: return { 'finish': // a }; llvm-svn: 217235
* clang-format: [JS] Support alternative operator names as identifiers.Daniel Jasper2014-09-041-0/+4
| | | | | | | | | | Before: not. and . or . not_eq = 1; After: not.and.or.not_eq = 1; llvm-svn: 217179
* clang-format: [JS] Supprot "catch" as function name.Daniel Jasper2014-09-041-0/+3
| | | | | | | | | | Before: someObject.catch (); After: someObject.catch(); llvm-svn: 217158
* clang-format: [JS] Support comments in dict literals.Daniel Jasper2014-09-041-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Before: var stuff = { // comment for update update : false, // comment for update modules : false, // comment for update tasks : false }; After: var stuff = { // comment for update update : false, // comment for update modules : false, // comment for update tasks : false }; llvm-svn: 217157
* Add matcher for linkage specificationManuel Klimek2014-09-041-0/+5
| | | | | | Patch by Jacques Pienaar. llvm-svn: 217135
* ASTMatchers: Add a matcher to detect whether a decl or stmt is inside a ↵Benjamin Kramer2014-09-031-0/+56
| | | | | | | | | | | template instantiation. This is hoisted from clang-tidy where it's used everywhere. The implementation is not particularly efficient right now, but there is no easy fix for that. Differential Revision: http://reviews.llvm.org/D5085 llvm-svn: 217029
* clang-format: Add an option 'SpaceAfterCStyleCast'.Daniel Jasper2014-09-031-0/+33
| | | | | | | | | | | | | | | | | This permits to add a space after closing parenthesis of a C-style cast. Defaults to false to preserve old behavior. Fixes llvm.org/PR19982. Before: (int)i; After: (int) i; Patch by Marek Kurdej. llvm-svn: 217022
* clang-format: Fix unary operator detection in corner case.Daniel Jasper2014-08-291-0/+1
| | | | | | | | | | Before: decltype(* ::std::declval<const T &>()) void F(); After: decltype(*::std::declval<const T &>()) void F(); llvm-svn: 216724
* unique_ptrify SourceManager::createFileIDDavid Blaikie2014-08-297-13/+12
| | | | llvm-svn: 216715
* Overload SourceManager::overrideFileContents so that unconditionally passing ↵David Blaikie2014-08-272-3/+3
| | | | | | | | | | ownership is explicitly done using unique_ptr. Only those callers who are dynamically passing ownership should need the 3 argument form. Those accepting the default ("do pass ownership") should do so explicitly with a unique_ptr now. llvm-svn: 216614
* Update for LLVM api change.Rafael Espindola2014-08-2711-35/+41
| | | | llvm-svn: 216585
* clang-format: Fix regression in formatting of braced initializers.Daniel Jasper2014-08-271-0/+2
| | | | | | | | | | | | Before: Node n{1, Node{1000}, // 2}; After: Node n{1, Node{1000}, // 2}; llvm-svn: 216540
* ClangCodeGenTests: Prune redundant libdeps.NAKAMURA Takumi2014-08-272-7/+2
| | | | llvm-svn: 216516
* [CMake] ClangCodeGenTests: Add Core. It's referenced by the test.NAKAMURA Takumi2014-08-271-0/+1
| | | | llvm-svn: 216515
* ClangCodeGenTests: Reorder libdeps.NAKAMURA Takumi2014-08-272-4/+4
| | | | llvm-svn: 216514
* ClangCodeGenTests: Quick fix to USEDLIBS. clangCodeGen requires, at least, ↵NAKAMURA Takumi2014-08-271-3/+3
| | | | | | AST, Basic, Frontend, and Lex. llvm-svn: 216509
* Fix missing component.Julien Lerouge2014-08-271-1/+2
| | | | llvm-svn: 216506
* clang-format: Don't butcher __asm blocks.Daniel Jasper2014-08-261-0/+15
| | | | | | | | Instead completely cop out of formatting them for now. This fixes llvm.org/PR20618. llvm-svn: 216501
* Attempt to address cmake buildbot failureKeno Fischer2014-08-261-2/+3
| | | | | | | | | CMake gets confused by the fact that both LLVM and Clang now have a CodeGen unittest. Rename the target to avoid that. The new test was also missing ProfileData (thanks to Julien Lerouge for pointing that out) llvm-svn: 216499
* Don't segfault in EmitCXXGlobalInitFunc when main file is a membufKeno Fischer2014-08-265-1/+118
| | | | | | | | | | | | | | Summary: When the main file is created from a membuffer, there is no file entry that can be retrieved. This uses "__GLOBAL_I_a" in that case which is what was always used before r208128. Reviewers: majnemer, thakis Reviewed By: thakis Subscribers: yaron.keren, rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D5043 llvm-svn: 216495
* Switching from std::vector to llvm::ArrayRef per post-commit review suggestion.Aaron Ballman2014-08-261-3/+1
| | | | llvm-svn: 216463
* Some versions of MSVC do not support initializer list construction of ↵Aaron Ballman2014-08-261-1/+2
| | | | | | vectors, so this fixes a broken build from r216385. llvm-svn: 216457
* clang-format: New option SpacesInSquareBrackets.Daniel Jasper2014-08-261-0/+23
| | | | | | | | | | | | | | | | Before: int a[5]; a[3] += 42; After: int a[ 5 ]; a[ 3 ] += 42; Fixes LLVM bug #17887 (http://llvm.org/bugs/show_bug.cgi?id=17887). Patch by Marek Kurdej, thank you! llvm-svn: 216449
* clang-format: Improve handling of block comments in braced lists.Daniel Jasper2014-08-261-8/+5
| | | | | | | | | | | | Before: std::vector<int> v = { 1, 0 /* comment */ }; After: std::vector<int> v = {1, 0 /* comment */}; llvm-svn: 216445
* ASTVector: Fix return value of various insert() methods.Will Dietz2014-08-251-3/+73
| | | | | | | | | Error caught using -fsanitize=pointer-overflow. Expand ASTVectorTest to verify basic behavior, test fails without functionality in this patch. llvm-svn: 216385
* Add hasAttr matcher for declarations.Manuel Klimek2014-08-252-9/+18
| | | | | | | | Delete special-case CUDA attribute matchers. Patch by Jacques Pienaar. llvm-svn: 216379
* clang-format: Understand sequenced casts.Daniel Jasper2014-08-251-0/+1
| | | | | | | | | | | | This fixed llvm.org/PR20712. Before: int i = (int)(int) -2; After: int i = (int)(int)-2; llvm-svn: 216378
* clang-format: Improve formatting of nested builder-type calls.Daniel Jasper2014-08-251-1/+4
| | | | | | | | | | | | Before: f(FirstToken->WhitespaceRange.getBegin().getLocWithOffset( First->LastNewlineOffset)); After: f(FirstToken->WhitespaceRange.getBegin() .getLocWithOffset(First->LastNewlineOffset)); llvm-svn: 216377
* Create a std::unique_ptr earlier.Rafael Espindola2014-08-171-3/+3
| | | | | | Thanks to David Blaikie for the suggestion. llvm-svn: 215865
* Convert a few ownership comments with std::unique_ptr.Rafael Espindola2014-08-171-1/+2
| | | | llvm-svn: 215853
* Add isDeleted() matcher for FunctionDecl nodes.Samuel Benzaquen2014-08-151-0/+7
| | | | | | | | | | Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D4911 llvm-svn: 215714
* clang-format: Prefer breaking after return type over template paramDaniel Jasper2014-08-151-0/+4
| | | | | | | | | | | | | | Before: typename aaaaaaaaaa<aaaaaa>::aaaaaaaaaaa aaaaaaaaaa< aaaaaa>::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bool *aaaaaaaaaaaaaaaaaa, bool *aa) {} After: typename aaaaaaaaaa<aaaaaa>::aaaaaaaaaaa aaaaaaaaaa<aaaaaa>::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( bool *aaaaaaaaaaaaaaaaaa, bool *aa) {} llvm-svn: 215693
* clang-format: [proto] Understand text-format nesting without :Daniel Jasper2014-08-151-0/+5
| | | | | | | | | | | | | | | | | Before: option (MyProto.options) = { field_c : "OK" msg_field{field_d : 123} }; After: option (MyProto.options) = { field_c : "OK" msg_field{field_d : 123} }; (Note that the colon after "msg_field" is optional). llvm-svn: 215692
* Split a large unit-test, so that it doesn't exceed stack frame size in ↵Alexander Kornienko2014-08-141-7/+12
| | | | | | certain test environments llvm-svn: 215639
* clang-format: Fix AlwaysBreakAfterDefinitionReturnType in Stroutrup styleDaniel Jasper2014-08-141-0/+23
| | | | | | | | | | | | | | | | | | | | | Before: template <class T> T *f(T &c) // Problem here: no line break before f { return NULL; } After: template <class T> T * f(T &c) { return NULL; } Patch by Marek Kurdej, thank you! llvm-svn: 215633
* clang-format: Support chained dereferenced assignments.Daniel Jasper2014-08-141-0/+4
| | | | | | | | | | Before: x = * a(x) = *a(y); After: x = *a(x) = *a(y); llvm-svn: 215632
* clang-format: Support breaking arguments of function type typedefs.Daniel Jasper2014-08-141-0/+4
| | | | | | | | | | | | | Before: typedef size_t (*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)( const aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: typedef size_t (*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)( const aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 215631
* Header guard canonicalization, clang part.Benjamin Kramer2014-08-134-9/+9
| | | | | | Modifications made by clang-tidy with minor tweaks. llvm-svn: 215557
OpenPOWER on IntegriCloud