summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: Fixed typecast getting put on a separate line from theDaniel Jasper2015-10-121-0/+7
| | | | | | | | | | key in Obj-C dictionary literals This fixes: https://llvm.org/PR22647 Patch by Kent Sutherland. Thank you. llvm-svn: 250010
* clang-format: [JS] handle character classes in regexes.Daniel Jasper2015-10-121-0/+6
| | | | | | | | | Slashes in regular expressions do not need to be escaped and do not terminate the regular expression even without a preceding backslash. Patch by Martin Probst. Thank you. llvm-svn: 250009
* Fix VFS GCC unittest on WindowsReid Kleckner2015-10-091-0/+3
| | | | llvm-svn: 249846
* [VFS] Just normalize away .. and . in paths for in-memory file systems.Benjamin Kramer2015-10-091-0/+3
| | | | | | This simplifies the code and gets us support for .. for free. llvm-svn: 249830
* [VFS] Wire up multilib toolchain code to the VFS.Benjamin Kramer2015-10-091-3/+7
| | | | | | This lets a VFSified driver actually validate the GCC paths. llvm-svn: 249829
* [VFS] Port tooling to use the in-memory file system.Benjamin Kramer2015-10-091-9/+24
| | | | | | | | | | This means file remappings can now be managed by ClangTool (or a ToolInvocation user) instead of by ToolInvocation itself. The ToolInvocation remapping is still in place so users can migrate. Differential Revision: http://reviews.llvm.org/D13474 llvm-svn: 249815
* [VFS] Use VFS instead of virtual files in PPCallbacks test.Benjamin Kramer2015-10-081-4/+6
| | | | llvm-svn: 249693
* Fix a shared CMake build by linking with libclangBasic.Benjamin Kramer2015-10-071-0/+1
| | | | | | Patch by Jan Vesely! llvm-svn: 249608
* [VFS] Port driver tool chains to VFS.Benjamin Kramer2015-10-072-0/+75
| | | | | | | There are still some loose ends here but it's sufficient so we can detect GCC headers that are inside of a VFS. llvm-svn: 249556
* clang-format: Fixed missing space between Obj-C for/in and a typecast.Daniel Jasper2015-10-071-0/+13
| | | | | | | | | | | | | | | | | Fixes this bug: https://llvm.org/bugs/show_bug.cgi?id=24504 TokenAnnotator::spaceRequiredBetween was handling TT_ForEachMacro but not TT_ObjCForIn, so lines that look like: for (id nextObject in (NSArray *)myArray) would incorrectly turn into: for (id nextObject in(NSArray *)myArray) Patch by Kent Sutherland, thank you. llvm-svn: 249553
* [clang-format] Stop alignment sequences on open braces and parens whenDaniel Jasper2015-10-071-0/+30
| | | | | | | | | | | | | | | | | aligning assignments. This was done correctly when aligning the declarations, but not when aligning assignments. FIXME: The code between assignments and declarations alignment is roughly duplicated and would benefit from factorization. Bug 25090: https://llvm.org/bugs/show_bug.cgi?id=25090 Patch by Beren Minor. Thank you. llvm-svn: 249552
* [VFS] Also drop '.' when adding files to an in-memory FS.Benjamin Kramer2015-10-071-0/+3
| | | | | | Otherwise we won't be able to find them later. llvm-svn: 249525
* Make clang-format actually respect custom brace wrapping flags.Daniel Jasper2015-10-071-2/+11
| | | | | | This fixes llvm.org/PR25073. llvm-svn: 249519
* clang-format: Fix false ObjC block detection.Daniel Jasper2015-10-071-0/+2
| | | | | | | | | | | Before: inline A operator^(const A &lhs, const A &rhs) {} int i; After: inline A operator^(const A &lhs, const A &rhs) {} int i; llvm-svn: 249517
* clang-format: Understand array reference types.Daniel Jasper2015-10-071-0/+1
| | | | | | | | | | | | Before: void f(Type(&parameter)[10]) {} void f(Type (*parameter)[10]) {} After: void f(Type (&parameter)[10]) {} void f(Type (*parameter)[10]) {} llvm-svn: 249502
* clang-format: Fix false positive in pointer/reference detection.Daniel Jasper2015-10-071-0/+1
| | | | | | | | | | Before: return options != nullptr &&operator==(*options); After: return options != nullptr && operator==(*options); llvm-svn: 249501
* Fix Clang-tidy modernize-use-nullptr warnings in source directories; other ↵Hans Wennborg2015-10-062-4/+5
| | | | | | | | | | minor cleanups Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13406 llvm-svn: 249484
* [VFS] Put the incoming name in the file status to make InMemoryFS behave ↵Benjamin Kramer2015-10-061-0/+13
| | | | | | more like a real FS. llvm-svn: 249409
* ToolingTests: Tweak getAnyTarget() to match "x86_64".NAKAMURA Takumi2015-10-061-3/+5
| | | | | | Both "x86" and "x86-64" are incompatible to triple's arch. llvm-svn: 249403
* BasicTests: Suppress InMemoryFileSystemTest.WindowsPath on win32 while ↵NAKAMURA Takumi2015-10-061-0/+2
| | | | | | investigating. llvm-svn: 249395
* clang-format: Make IncludeCategories configurable in .clang-format file.Daniel Jasper2015-10-061-0/+12
| | | | | | | | | This was made much easier by introducing an IncludeCategory struct to replace the previously used std::pair. Also, cleaned up documentation and added examples. llvm-svn: 249392
* Adds a way for tools to deduce the target config from a compiler name.Manuel Klimek2015-10-062-0/+81
| | | | | | | | | | | | | Adds `addTargetAndModeForProgramName`, a utility function that will add appropriate `-target foo` and `--driver-mode=g++` tokens to a command line for driver invocations of the form `a/b/foo-g++`. It is intended to support tooling: for example, should a compilation database record some invocation of `foo-g++` without these implicit flags, a Clang tool may use this function to add them back. Patch by Luke Zarko. llvm-svn: 249391
* [VFS] Transition clang-format to use an in-memory FS.Benjamin Kramer2015-10-061-0/+12
| | | | | | | | | | | Apart from being cleaner this also means that clang-format no longer has access to the host file system. This isn't necessary because clang-format never reads includes :) Includes minor tweaks and bugfixes found in the VFS implementation while running clang-format tests. llvm-svn: 249385
* Fix the MSVC build.Rafael Espindola2015-10-051-4/+4
| | | | | | No idea what asymmetry MSVC is findind. llvm-svn: 249346
* Adding an AST node matcher for NonTypeTemplateParmDecl objects.Aaron Ballman2015-10-051-0/+7
| | | | llvm-svn: 249341
* Adding a narrowing AST matcher for FunctionDecl::isVariadic(), plus tests ↵Aaron Ballman2015-10-052-0/+14
| | | | | | and documentation. llvm-svn: 249321
* [VFS] Add working directories to every virtual file system.Benjamin Kramer2015-10-051-0/+6
| | | | | | | | | | | | For RealFileSystem this is getcwd()/chdir(), the synthetic file systems can make up one for themselves. OverlayFileSystem now synchronizes the working directories when a new FS is added to the overlay or the overlay working directory is set. This allows purely artificial file systems that have zero ties to the underlying disks. Differential Revision: http://reviews.llvm.org/D13430 llvm-svn: 249316
* [VFS] Add an in-memory file system implementation.Benjamin Kramer2015-10-052-11/+85
| | | | | | | | | | This is a simple file system tree of memory buffers that can be filled by a client. In conjunction with an OverlayFS it can be used to make virtual files accessible right next to physical files. This can be used as a replacement for the virtual file handling in FileManager and which I intend to remove eventually. llvm-svn: 249315
* [VFS] Remove setName from the file interface.Benjamin Kramer2015-10-051-6/+6
| | | | | | | This streamlines the interface a bit and makes Status more immutable. No functional change intended. llvm-svn: 249310
* Pass SourceRange by value in a test I missed in r249259.Craig Topper2015-10-041-2/+2
| | | | llvm-svn: 249260
* [clang-format] Add support of consecutive declarations alignmentDaniel Jasper2015-10-011-0/+184
| | | | | | | | | | | | | | | | | | | This allows clang-format to align identifiers in consecutive declarations. This is useful for increasing the readability of the code in the same way the alignment of assignations is. The code is a slightly modified version of the consecutive assignment alignment code. Currently only the identifiers are aligned, and there is no support of alignment of the pointer star or reference symbol. The patch also solve the issue of alignments not being possible due to the ColumnLimit for both the existing AlignConsecutiveAligments and the new AlignConsecutiveDeclarations. Patch by Beren Minor, thank you. Review: http://reviews.llvm.org/D12362 llvm-svn: 248999
* clang-format: Add a new brace style "custom" as well as flags toDaniel Jasper2015-09-291-1/+30
| | | | | | | | | | | | | | | control the individual braces. The existing choices for brace wrapping are now merely presets for the different flags that get expanded upon calling the reformat function. All presets have been chose to keep the existing formatting, so there shouldn't be any difference in formatting behavior. Also change the dump_format_style.py to properly document the nested structs that are used to keep these flags discoverable among all the configuration flags. llvm-svn: 248802
* clang-format: Extend #include sorting functionalityDaniel Jasper2015-09-291-7/+37
| | | | | | | | | Recognize the main module header as well as different #include categories. This should now mimic the behavior of llvm/utils/sort_includes.py as well as clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp very closely. llvm-svn: 248782
* clang-format: [JS] Support pseudo-keywordsDaniel Jasper2015-09-281-0/+13
| | | | | | | | | JavaScript allows keywords to appear in IdenfierName positions, e.g. fields, or object literal members, but not as plain identifiers. Patch by Martin Probst. Thank you! llvm-svn: 248714
* clang-format: [JS] handle let (ES6)Daniel Jasper2015-09-281-0/+2
| | | | | | Patch by Martin Probst. Thank you! llvm-svn: 248713
* clang-format: Add initial #include sorting capabilities.Daniel Jasper2015-09-233-0/+202
| | | | | | | | | To implement this nicely, add a function that merges two sets of replacements that are meant to be done in sequence. This functionality will also be useful for other applications, e.g. formatting the result of clang-tidy fixes. llvm-svn: 248367
* [tooling] Provide the compile commands of the JSON database in the order ↵Argyrios Kyrtzidis2015-09-221-0/+19
| | | | | | | | | | | that they were provided in the JSON file. This is useful for debugging of issues and reduction of test cases. For example, an issue may show up due to the order that some commands were processed. It is convenient to be able to remove commands from the file and still preserve the order that they are returned, instead of getting a completely different order when removing a few commands. llvm-svn: 248292
* clang-format: Fix alignConsecutiveAssignments.Daniel Jasper2015-09-221-0/+4
| | | | | | | | | | | | | It wasn't correctly handling this case: int oneTwoThree = 123; int oneTwo = 12; method(); Review: http://reviews.llvm.org/D12369 Patch by Beren Minor. Thank you! llvm-svn: 248254
* clang-format: Fix merging short case labels with comments.Daniel Jasper2015-09-211-0/+3
| | | | | | | | This fixes llvm.org/PR24877. Patch by Benjamin Daly, thank you! llvm-svn: 248145
* Rename AST node matchers to match the AST node names directly. Part of this ↵Aaron Ballman2015-09-178-321/+332
| | | | | | rename also splits recordDecl() (which used to match CXXRecordDecl) into recordDecl() (that matches RecordDecl) and cxxRecordDecl (that matches CXXRecordDecl). Also adds isStruct(), isUnion(), and isClass() narrowing matchers for RecordDecl objects. llvm-svn: 247885
* [tooling] Add unit tests for change in r247468.Argyrios Kyrtzidis2015-09-161-3/+7
| | | | llvm-svn: 247832
* Remove accidental superfluous newline added in r247750.Nico Weber2015-09-151-1/+0
| | | | llvm-svn: 247752
* clang-format: In Java, `assert` is followed by an expression.Nico Weber2015-09-151-0/+5
| | | | | | Before: assert a&& b; Now: assert a && b; llvm-svn: 247750
* Fixed HasDeclarationMatcher to properly convert all types into decls where ↵Aaron Ballman2015-09-111-0/+48
| | | | | | | | | | | | | | possible. Added objcObjectPointerType(), objcInterfaceDecl(), templateTypeParmType(), injectedClassNameType(), and unresolvedUsingTypenameDecl(). Updated documentation for pointerType() to call out that it does not match ObjCObjectPointerType types. Changed pointsTo() to handle ObjCObjectPointerType as well as PointerType. While this may seem like a lot of unrelated changes, they all relate back to fixing HasDeclarationMatcher. This now allows us to write a matcher like: varDecl(hasType(namedDecl(hasName("Foo")))) that matches code using typedefs, objc interfaces, template type parameters, injected class names, or unresolved using typenames. llvm-svn: 247404
* Fix performance regression when running clang tools.Manuel Klimek2015-09-081-1/+3
| | | | | | | Brings tool start time for a large synthetic test case down from (on my machine) 4 seconds to 0.5 seconds. llvm-svn: 247018
* Fix documentation of numSelectorArgs.Manuel Klimek2015-09-081-0/+3
| | | | | | | | | | | | Currently, the documentation for numSelectorArgs includes an incorrect example. It shows a case where an argument of 1 will match a property getter, but a getter will be matched only when N == 0. This diff corrects the documentation and adds a test for numSelectorArgs(0). Patch by Dave Lee. llvm-svn: 246998
* Fixing a bug where hasType(decl()) would fail to match on C code involving ↵Aaron Ballman2015-09-042-0/+9
| | | | | | structs or unions. llvm-svn: 246860
* Adding an AST matcher for namespaceAliasDecl.Aaron Ballman2015-08-281-0/+5
| | | | llvm-svn: 246322
* clang-format: Don't let a leading "template <..>" lead to wrapped initializers.Daniel Jasper2015-08-271-0/+7
| | | | | | | | | | | | | | | | | Before: Constructor() : initializer(0) {} template <typename T> Constructor() : initializer(0) {} After: Constructor() : initializer(0) {} template <typename T> Constructor() : initializer(0) {} llvm-svn: 246146
* [ASTMatchers] Add type matcher for SubstTemplateTypeParmType.Samuel Benzaquen2015-08-261-0/+12
| | | | llvm-svn: 246037
OpenPOWER on IntegriCloud