summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: Add space before member function reference qualifiers.Daniel Jasper2015-08-251-27/+30
| | | | | | | | | | | | Before: SomeType MemberFunction(const Deleted &)&; After: SomeType MemberFunction(const Deleted &) &; Seems to be much more common. llvm-svn: 245934
* clang-format: Always allow break after leading annotations.Daniel Jasper2015-08-241-0/+2
| | | | | | | | | | | Before: DEPRECATED("Use NewClass::NewFunction instead.") int OldFunction( const string &parameter) {} Could not be formatted at all, as clang-format would both require and disallow the break before "int". llvm-svn: 245846
* clang-format: Make formatting of member function reference qualifiersDaniel Jasper2015-08-241-3/+6
| | | | | | | | | | | | | | more consistent. Before: SomeType MemberFunction(const Deleted &)&&; SomeType MemberFunction(const Deleted &) && { ... } After: SomeType MemberFunction(const Deleted &)&&; SomeType MemberFunction(const Deleted &)&& { ... } llvm-svn: 245843
* clang-format: Properly handle braced lists in macros.Daniel Jasper2015-08-241-0/+1
| | | | | | | | | | | | Before: #define A \ { a, a } \ , After: #define A {a, a}, llvm-svn: 245837
* clang-format: Be more conservative about specially indenting blocks in C++.Daniel Jasper2015-08-211-12/+21
| | | | | | | | | | | | | | | | | | | | | | This is a bit of a step back of what we did in r222531, as there are some corner cases in C++, where this kind of formatting is really bad. Example: Before: virtual aaaaaaaaaaaaaaaa(std::function<bool()> IsKindWeWant = [&]() { return true; }, aaaaa aaaaaaaaa); After: virtual aaaaaaaaaaaaaaaa(std::function<bool()> IsKindWeWant = [&]() { return true; }, aaaaa aaaaaaaaa); The block formatting logic in JavaScript will probably go some other changes, too, and we'll potentially be able to make the rules more consistent again. For now, this seems to be the best approach for C++. llvm-svn: 245694
* Add AST narrowing matchers for inline and anonymous namespaces. Since the ↵Aaron Ballman2015-08-181-0/+12
| | | | | | inline keyword can also be specified on a FunctionDecl, this is a polymorphic matcher. llvm-svn: 245337
* clang-format: Don't remove space between #elif and parentheses.Daniel Jasper2015-08-141-0/+2
| | | | | | | | | | Before: #elif(AAAA && BBBB) After: #elif (AAAA && BBBB) llvm-svn: 245043
* Add structed way to express command line options in the compilation database.Manuel Klimek2015-08-141-1/+24
| | | | | | | | | | | | | | | | | | | | Currently, arguments are passed via the string attribute 'command', assuming a shell-escaped / quoted command line to extract the original arguments. This works well enough on Unix systems, but turns out to be problematic for Windows tools to generate. This CL adds a new attribute 'arguments', an array of strings, which specifies the exact command line arguments. If 'arguments' is available in the compilation database, it is preferred to 'commands'. Currently there is no plan to retire 'commands': there are enough different use cases where users want to create their own mechanism for creating compilation databases, that it doesn't make sense to force them all to implement shell command line parsing. Patch by Daniel Dilts. llvm-svn: 245036
* Wdeprecated: CommentVerifiers are returned by value, make sure they're ↵David Blaikie2015-08-131-0/+4
| | | | | | correctly copy/moveable llvm-svn: 244958
* clang-format: Inside decltype(), there is an expression.Daniel Jasper2015-08-131-0/+1
| | | | | | | | | | Before: decltype(a* b) F(); After: decltype(a * b) F(); llvm-svn: 244891
* clang-format: Fix incorrect lambda-detection.Daniel Jasper2015-08-131-0/+1
| | | | | | | | | | Before: [ a, a ]() -> a<1>{}; After: [a, a]() -> a<1> {}; llvm-svn: 244890
* Add a polymorphic AST matcher for testing whether a constructor or a ↵Aaron Ballman2015-08-111-0/+14
| | | | | | conversion declaration is marked as explicit or not. llvm-svn: 244666
* Add an AST matcher to match member intializers of a CXXCtorInitializer.Aaron Ballman2015-08-111-0/+6
| | | | llvm-svn: 244662
* clang-format: Make SpaceBeforeParens work with overloaded operators.Daniel Jasper2015-08-111-0/+4
| | | | | | Patch by Jon Chesterfield, thank you! llvm-svn: 244660
* Add WebKit brace style configuration option.Roman Kashitsyn2015-08-101-7/+50
| | | | | | | | | | | | | | | | | | Summary: Add brace style `BS_WebKit` as described on https://www.webkit.org/coding/coding-style.html: * Function definitions: place each brace on its own line. * Other braces: place the open brace on the line preceding the code block; place the close brace on its own line. Set brace style used in `getWebKitStyle()` to the newly added `BS_WebKit`. Reviewers: djasper, klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D11837 llvm-svn: 244446
* Add AST matchers for narrowing constructors that are default, copy, or move ↵Aaron Ballman2015-08-051-0/+41
| | | | | | constructors, as well as functionality to determine whether a ctor initializer is a base initializer. llvm-svn: 244036
* Do not force linebreaks when MaxEmptyLinesToKeep is 0.Manuel Klimek2015-07-281-0/+7
| | | | | | | | | | | | | | | | Previously we would format call( p); as call( p); with MaxEmptyLinesToKeep == 0. Now we format it as: call(p); llvm-svn: 243429
* Add an AST matcher, isFinal(), for testing whether a method or class ↵Aaron Ballman2015-07-241-0/+9
| | | | | | declaration are marked final. llvm-svn: 243107
* Fix -Wextra-semi warnings.Hans Wennborg2015-07-224-6/+6
| | | | | | | | Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D11401 llvm-svn: 242931
* clang-format: Fix unary operator detection in for loops.Daniel Jasper2015-07-211-0/+1
| | | | | | | | | | Before: for (;; * a = b) {} After: for (;; *a = b) {} llvm-svn: 242849
* clang-format: Fix crasher when a UTF8 character is found in an escapeDaniel Jasper2015-07-201-0/+5
| | | | | | sequence. Discovered by the fuzzer. llvm-svn: 242738
* clang-format: Take nested lines into account when detection C++03Daniel Jasper2015-07-181-0/+11
| | | | | | compatibility and variable alignment. llvm-svn: 242611
* [ASTMatchers] Use provided target NodeKind instead of inferring it from the ↵Samuel Benzaquen2015-07-171-0/+10
| | | | | | | | | | matchers. Individual matchers might not be convertible to each other's kind, but they might still all be convertible to the target kind. All the callers already know the target kind, so just pass it down. llvm-svn: 242534
* Make the clang module container format selectable from the command line.Adrian Prantl2015-07-171-1/+1
| | | | | | | | | | | | | - introduces a new cc1 option -fmodule-format=[raw,obj] with 'raw' being the default - supports arbitrary module container formats that libclang is agnostic to - adds the format to the module hash to avoid collisions - splits the old PCHContainerOperations into PCHContainerWriter and a PCHContainerReader. Thanks to Richard Smith for reviewing this patch! llvm-svn: 242499
* clang-format: Respect IndentWrappedFunctionNames when aligning colonsDaniel Jasper2015-07-161-0/+16
| | | | | | | | | | | | | | | | Before: - (void)shortf:(GTMFoo *)theFoo dontAlignNamef:(NSRect)theRect { } After: - (void)shortf:(GTMFoo *)theFoo dontAlignNamef:(NSRect)theRect { } Patch by Kwasi Mensah, thank you! llvm-svn: 242484
* clang-format: [Proto] Handle enum bodies differently.Daniel Jasper2015-07-161-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | In proto, enum constants can contain complex options and should be handled more like individual declarations. Before: enum Type { UNKNOWN = 0 [(some_options) = { a: aa, b: bb }]; }; After: enum Type { UNKNOWN = 0 [(some_options) = { a: aa, b: bb }]; }; llvm-svn: 242404
* clang-format: Fix return type breaking with overloaded operator functionsBirunthan Mohanathas2015-07-151-0/+26
| | | | | | Differential Revision: http://reviews.llvm.org/D11177 llvm-svn: 242316
* Add the ability to AST match a variable declaration that is an exception ↵Aaron Ballman2015-07-151-0/+4
| | | | | | variable. llvm-svn: 242303
* clang-format: Fix column layout with a comment in the last line.Daniel Jasper2015-07-151-0/+5
| | | | | | | | | | | | | | | | | | Before: int aaaaa[] = { 1, 2, 3, // comment 4, 5, 6 // comment }; After: int aaaaa[] = { 1, 2, 3, // comment 4, 5, 6 // comment }; llvm-svn: 242299
* clang-format: Fix formatting of multiple lambdas in initializers.Daniel Jasper2015-07-141-0/+9
| | | | | | | | | | | | | | | | | | | | Before: SomeFunction({[&] { // comment }, [&] { // comment }}); After: SomeFunction({[&] { // comment }, [&] { // comment }}); llvm-svn: 242138
* [cuda] Driver changes to compile and stitch together host and device-side ↵Artem Belevich2015-07-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | CUDA code. NOTE: reverts r242077 to reinstate r242058, r242065, 242067 and includes fix for OS X test failures. - Changed driver pipeline to compile host and device side of CUDA files and incorporate results of device-side compilation into host object file. - Added a test for cuda pipeline creation in clang driver. New clang options: --cuda-host-only - Do host-side compilation only. --cuda-device-only - Do device-side compilation only. --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more than once in which case one device-compilation will be done per unique specified GPU architecture. Differential Revision: http://reviews.llvm.org/D9509 llvm-svn: 242085
* This reverts commit r242058, r242065, r242067.Rafael Espindola2015-07-131-1/+0
| | | | | | | | | | The tests were failing on OS X. Revert "[cuda] Driver changes to compile and stitch together host and device-side CUDA code." Revert "Fixed regex to properly match '64' in the test case." Revert "clang/test/Driver/cuda-options.cu REQUIRES clang-driver, at least." llvm-svn: 242077
* [cuda] Driver changes to compile and stitch together host and device-side ↵Artem Belevich2015-07-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | CUDA code. - Changed driver pipeline to compile host and device side of CUDA files and incorporate results of device-side compilation into host object file. - Added a test for cuda pipeline creation in clang driver. New clang options: --cuda-host-only - Do host-side compilation only. --cuda-device-only - Do device-side compilation only. --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more than once in which case one device-compilation will be done per unique specified GPU architecture. Differential Revision: http://reviews.llvm.org/D9509 llvm-svn: 242058
* Fix clang/unittests/ASTMatchers/Dynamic/Makefile. clangDynamicASTMatchers ↵NAKAMURA Takumi2015-07-131-1/+3
| | | | | | should be linked in advance of clangAST and clangASTMatchers. llvm-svn: 242005
* Tweak libclang's users, c-arcmt-test, c-index-test and libclangTests to ↵NAKAMURA Takumi2015-07-121-0/+4
| | | | | | satisfy LDFLAGS=-static. llvm-svn: 241992
* Reformat Makefile.NAKAMURA Takumi2015-07-121-1/+6
| | | | llvm-svn: 241991
* clang-format: Add Mozilla brace breaking styleBirunthan Mohanathas2015-07-121-0/+46
| | | | | | Differential Revision: http://reviews.llvm.org/D10883 llvm-svn: 241986
* Add a missing dependency to unittests/Frontend.Adrian Prantl2015-07-101-0/+1
| | | | | | PR24067. llvm-svn: 241915
* clang-format: [JS] Assign proper penalties when breaking a type annotationDaniel Jasper2015-07-101-0/+4
| | | | | | | | | | | | | | | | Before: class Test { aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaa): aaaaaaaaaaaaaaaaaaaaaa {} } After: class Test { aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaa): aaaaaaaaaaaaaaaaaaaaaa {} } llvm-svn: 241908
* Add clang_free to libclang to free memory allocated in libclang.Yaron Keren2015-07-091-2/+2
| | | | | | | | | | | | | | One of the problems libclang tests has running under Windows is memory allocated in libclang.dll but being freed in the test executable, possibly by a different memory manager. This patch exposes a new export function, clang_free(), used to free any allocated memory with the same libclang.dll memory manager that allocated the memory. http://reviews.llvm.org/D10949 Reviewed by Reid Kleckner, Douglas Gregor. llvm-svn: 241789
* clang-format: Break after "for (" less eagerly.Daniel Jasper2015-07-071-0/+4
| | | | | | | | | | | | | | | | Before: for ( auto aaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); aaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbbbbbbb; ++aaaaaaaaaaaaaaaaaaaaaaaaaaa) { After: for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); aaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbbbbbbb; ++aaaaaaaaaaaaaaaaaaaaaaaaaaa) { llvm-svn: 241601
* clang-format: Don't wrap before the ] of a lambda introducer.Daniel Jasper2015-07-071-0/+5
| | | | | | | | | | | | | | | | Before: return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa([= ](int iiiiiiiiiiii) { return aaaaaaaaaaaaaaaaaaaaaaa != aaaaaaaaaaaaaaaaaaaaaaa; }); After: return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa([=]( int iiiiiiiiiiii) { return aaaaaaaaaaaaaaaaaaaaaaa != aaaaaaaaaaaaaaaaaaaaaaa; }); llvm-svn: 241583
* clang-format: [JS] Properly reset parse state after parsing interface.Daniel Jasper2015-07-061-0/+4
| | | | llvm-svn: 241446
* clang-format: [JS] Prevent confusing TypeScript parameters wraps.Daniel Jasper2015-07-061-0/+3
| | | | | | | | | | | | | Before: aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa): aaaaaaaaaaaaaaaaaaaaaa {} After: aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa): aaaaaaaaaaaaaaaaaaaaaa {} llvm-svn: 241444
* clang-format: Fix __attribute__ being treated as decl name.Daniel Jasper2015-07-061-0/+5
| | | | | | | | | | | __attribute__ was treated as the name of a function definition, with the tokens in parentheses being the parameter list. This formats incorrectly with AlwaysBreakAfterDefinitionReturnType. Fix it by treating __attribute__ like decltype. Patch by Strager Neds, thank you. llvm-svn: 241439
* Replace some const std::string & with llvm::StringRef or std::stringYaron Keren2015-07-063-26/+26
| | | | | | | | and std::move to avoid implicit std::string construction. Patch by Eugene Kosov. llvm-svn: 241433
* Document problems when trying libclang tests on Windows 7.Yaron Keren2015-07-051-1/+2
| | | | llvm-svn: 241407
* clang-format: Add MacroBlock{Begin,End} optionsBirunthan Mohanathas2015-07-031-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MacroBlockBegin and MacroBlockEnd options make matching macro identifiers behave like '{' and '}', respectively, in terms of indentation. Mozilla code, for example, uses several macros that begin and end a scope. Previously, Clang-Format removed the indentation resulting in: MACRO_BEGIN(...) MACRO_ENTRY(...) MACRO_ENTRY(...) MACRO_END Now, using the options MacroBlockBegin: "^[A-Z_]+_BEGIN$" MacroBlockEnd: "^[A-Z_]+_END$" will yield the expected result: MACRO_BEGIN(...) MACRO_ENTRY(...) MACRO_ENTRY(...) MACRO_END Differential Revision: http://reviews.llvm.org/D10840 llvm-svn: 241363
* clang-format: [JS] Allow line breaks after TypeScript type colons.Daniel Jasper2015-07-031-0/+2
| | | | llvm-svn: 241339
* clang-format: [Java/JS] Properly support instanceof and its precedence.Daniel Jasper2015-07-031-0/+2
| | | | llvm-svn: 241337
OpenPOWER on IntegriCloud