summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-doc] Add unit tests for bitcodeJulie Hockett2018-10-1627-548/+807
| | | | | | | | | | | | Adds unit tests for the BitcodeWriter and BitcodeReader libraries. This is part of a move to convert clang-doc's tests to a more maintainable unit test framework, with a smaller number of integration tests to maintain and more granular failure feedback. Differential Revision: https://reviews.llvm.org/D53082 llvm-svn: 344651
* [clang-doc] Add unit tests for serializationJulie Hockett2018-10-165-0/+609
| | | | | | | | | | | | Adds unit tests for the Serialize library. This is part of a move to convert clang-doc's tests to a more maintainable unit test framework, with a smaller number of integration tests to maintain and more granular failure feedback. Differential Revision: https://reviews.llvm.org/D53081 llvm-svn: 344650
* Revert "[clangd] Refactor JSON-over-stdin/stdout code into Transport ↵Krasimir Georgiev2018-10-1623-742/+341
| | | | | | | | | abstraction." This reverts commit r344620. Breaks upstream bots. llvm-svn: 344637
* [clangd] Refactor JSON-over-stdin/stdout code into Transport abstraction.Sam McCall2018-10-1623-341/+742
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This paves the way for alternative transports (mac XPC, maybe messagepack?), and also generally improves layering: testing ClangdLSPServer becomes less of a pipe dream, we split up the JSONOutput monolith, etc. This isn't a final state, much of what remains in JSONRPCDispatcher can go away, handlers can call reply() on the transport directly, JSONOutput can be renamed to StreamLogger and removed, etc. But this patch is sprawling already. The main observable change (see tests) is that hitting EOF on input is now an error: the client should send the 'exit' notification. This is defensible: the protocol doesn't spell this case out. Reproducing the current behavior for all combinations of shutdown/exit/EOF clutters interfaces. We can iterate on this if desired. Reviewers: jkorous, ioeric, hokein Subscribers: mgorny, ilya-biryukov, MaskRay, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53286 llvm-svn: 344620
* [clangd] Send CodeAction responses to textDocument/codeAction (LSP 3.8)Sam McCall2018-10-166-15/+229
| | | | | | | | | | | | | | Summary: I don't bother mirroring the full capabilities struct, just parse the bits we care about. I'll send a new patch to use this approach elsewhere too. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D53213 llvm-svn: 344617
* Remove possibility to change compile database path at runtimeSimon Marchi2018-10-165-69/+33
| | | | | | | | | | | | | | Summary: This patch removes the possibility to change the compilation database path at runtime using the didChangeConfiguration request. Instead, it is suggested to use the setting on the initialize request, and clangd whenever the user wants to use a different build configuration. Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53220 llvm-svn: 344614
* [clangd] Allow disble down traversals from root.Eric Liu2018-10-163-7/+32
| | | | | | | | | | | | | | Summary: This is useful for symbo scope proximity, where down traversals from the global scope if not desired. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53317 llvm-svn: 344604
* [clangd] Fix threading bugs in (not-yet-used) BackgroundIndex, re-enable test.Sam McCall2018-10-163-6/+6
| | | | | | | | | | | | | | | | | | | Summary: One relatively boring bug: forgot to notify the CV after enqueue. One much more fun bug: the thread member could access instance variables before they were initialized. Although the thread was last in the init list, QueueCV etc were listed after Thread in the class, so their default constructors raced with the thread itself. We have to get very unlucky to lose this race, I saw it 0.02% of the time. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D53313 llvm-svn: 344595
* [clangd] Optionally use dex for the preamble parts of the dynamic index.Sam McCall2018-10-1610-38/+64
| | | | | | | | | | | | | | | Summary: Reuse the old -use-dex-index experiment flag for this. To avoid breaking the tests, make Dex deduplicate symbols, addressing an old FIXME. Reviewers: hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53288 llvm-svn: 344594
* [clangd] Disable timeouting test while investigatingSam McCall2018-10-161-0/+3
| | | | llvm-svn: 344586
* [Fixed Point Arithmetic] Fix for clang-tools-extra warningLeonard Chan2018-10-151-38/+39
| | | | | | | | Fix for warnings generated on unhandled enum value `STK_FixedPoint`. Differential Revision: https://reviews.llvm.org/D53299 llvm-svn: 344549
* added fixLeonard Chan2018-10-151-0/+41
| | | | llvm-svn: 344548
* [clangd] Revert include path change in Dexp. NFCSam McCall2018-10-152-4/+2
| | | | llvm-svn: 344533
* [clangd] Add createIndex in dexpHaojian Wu2018-10-151-7/+9
| | | | | | | | | | | | | | | Summary: This would allow easily injecting our internal customization. Also updates the stale "symbol-collection-file" flag. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53292 llvm-svn: 344521
* [clangd] Use SyncAPI in more places in tests. NFCSam McCall2018-10-152-86/+53
| | | | llvm-svn: 344520
* [clangd] Minimal implementation of automatic static index (not enabled).Sam McCall2018-10-157-1/+325
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: See tinyurl.com/clangd-automatic-index for design and goals. Lots of limitations to keep this patch smallish, TODOs everywhere: - no serialization to disk - no changes to dynamic index, which now has a much simpler job - no partitioning of symbols by file to avoid duplication of header symbols - no reindexing of edited files - only a single worker thread - compilation database is slurped synchronously (doesn't scale) - uses memindex, rebuilds after every file (should be dex, periodically) It's not hooked up to ClangdServer/ClangdLSPServer yet: the layering isn't clear (it should really be in ClangdServer, but ClangdLSPServer has all the CDB interactions). Reviewers: ioeric Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D53032 llvm-svn: 344513
* [clangd] Remove an unused include header, NFC.Haojian Wu2018-10-151-1/+0
| | | | llvm-svn: 344510
* [clangd] dump xrefs information in dexp tool.Haojian Wu2018-10-152-9/+93
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53019 llvm-svn: 344508
* [clangd] Fix some references missing in dynamic index.Haojian Wu2018-10-152-17/+70
| | | | | | | | | | | | | | | | | | | Summary: Previously, SymbolCollector postfilters all references at the end to find all references of interesting symbols. It was incorrect when indxing main AST where we don't see locations of symbol declarations and definitions in the main AST (as those are in preamble AST). The fix is to do earily check during collecting references. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53273 llvm-svn: 344507
* Move some helpers from the global namespace into anonymous ones.Benjamin Kramer2018-10-131-1/+2
| | | | llvm-svn: 344468
* [clang-tidy] Fix for typos in the tests for `bugprone-exception-escape`Adam Balogh2018-10-131-3/+3
| | | | llvm-svn: 344445
* [clang-tidy] Optimize query in bugprone-exception-escapeAdam Balogh2018-10-133-3/+30
| | | | | | | | | | | | Checking whether a functions throws indirectly may be very expensive because it needs to visit its whole call graph. Therefore we should first check whether the function is forbidden to throw and only check whether it throws afterward. This also seems to solve bug https://bugs.llvm.org/show_bug.cgi?id=39167 where the execution time is so long that it seems to hang. Differential Revision: https://reviews.llvm.org/D53187 llvm-svn: 344444
* Revert "[clang-tidy] New checker for not null-terminated result caused by ↵Jonas Toth2018-10-1315-2246/+0
| | | | | | | | strlen(), size() or equal length" This reverts commit r344374. llvm-svn: 344442
* Revert "[doc] fix markup in clang-tidy bugprone-not-null-terminated-result"Jonas Toth2018-10-131-7/+3
| | | | | | This reverts commit r344379. llvm-svn: 344441
* [clang-tidy] add IgnoreMacros option to modernize-use-equals-deleteMiklos Vajna2018-10-135-2/+34
| | | | | | | | | | | | | | | And also enable it by default to be consistent with e.g. modernize-use-using. This improves consistency inside the check itself as well: both checks are now disabled in macros by default. This helps e.g. when running this check on client code where the macro is provided by the system, so there is no easy way to modify it. Reviewed By: alexfh Differential Revision: https://reviews.llvm.org/D53217 llvm-svn: 344440
* [clangd] NFC fix semicolon warningJonas Toth2018-10-121-1/+1
| | | | llvm-svn: 344384
* [doc] fix markup in clang-tidy bugprone-not-null-terminated-resultJonas Toth2018-10-121-3/+7
| | | | llvm-svn: 344379
* [clang-tidy] New checker for not null-terminated result caused by strlen(), ↵Jonas Toth2018-10-1215-0/+2246
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | size() or equal length New checker called bugprone-not-null-terminated-result. This check finds function calls where it is possible to cause a not null-terminated result. Usually the proper length of a string is strlen(src) + 1 or equal length of this expression, because the null terminator needs an extra space. Without the null terminator it can result in undefined behaviour when the string is read. The following function calls are checked: memcpy, wmemcpy, memcpy_s, wmemcpy_s, memchr, wmemchr, memmove, wmemmove, memmove_s, wmemmove_s, memset, wmemset, strerror_s, strncmp, wcsncmp, strxfrm, wcsxfrm The following is a real-world example where the programmer forgot to increase the passed third argument, which is size_t length. That is why the length of the allocated memory is problematic too. static char *StringCpy(const std::string &str) { char *result = reinterpret_cast<char *>(malloc(str.size())); memcpy(result, str.data(), str.size()); return result; } After running the tool fix-it rewrites all the necessary code according to the given options. If it is necessary, the buffer size will be increased to hold the null terminator. static char *StringCpy(const std::string &str) { char *result = reinterpret_cast<char *>(malloc(str.size() + 1)); strcpy(result, str.data()); return result; } Patch by Charusso. Differential ID: https://reviews.llvm.org/D45050 llvm-svn: 344374
* [clangd] Return Command objects from onCodeAction, rather than ad-hoc JSON. NFCSam McCall2018-10-122-9/+9
| | | | llvm-svn: 344363
* Fix one additional test broken by the YAML quoting change.Zachary Turner2018-10-121-2/+2
| | | | llvm-svn: 344362
* [clang-tidy] Fix check_clang_tidy.py trivially passing default CHECKZinovy Nis2018-10-121-35/+31
| | | | | | Differential Revision: https://reviews.llvm.org/D53194 llvm-svn: 344343
* [clang-tidy] White List Option for performance-unnecessary-value-param, ↵Adam Balogh2018-10-1213-11/+378
| | | | | | | | | | | | | | performance-unnecessary-copy-initialization and performance-for-range-copy New option added to these three checks to be able to silence false positives on types that are intentionally passed by value or copied. Such types are e.g. intrusive reference counting pointer types like llvm::IntrusiveRefCntPtr. The new option is named WhiteListTypes and can contain a semicolon-separated list of names of these types. Regular expressions are allowed. Default is empty. Differential Revision: https://reviews.llvm.org/D52727 llvm-svn: 344340
* [clangd] Support hover on "aut^o *".Haojian Wu2018-10-122-10/+33
| | | | | | | | | | Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D53186 llvm-svn: 344330
* [Documentation] Rephrase modernize-deprecated-ios-base-aliases description. ↵Eugene Zelenko2018-10-112-5/+15
| | | | | | Add clangd and clang-doc placeholders in Release Notes. llvm-svn: 344299
* [clang-move] Remove clang:: qualifierFangrui Song2018-10-111-69/+54
| | | | | | | | | | | | | | | | Summary: The use sites are enclosed by `namespace clang`, so clang:: is not necessary. Many unqualified names have already been used, e.g. SourceManager SourceLocation LangOptions. This change makes the code terser and more consistent. Reviewers: hokein Reviewed By: hokein Subscribers: ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D53060 llvm-svn: 344256
* [clangd] Remove no-op crash handler, we never set a crash context.Sam McCall2018-10-111-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I think this was just copied from somewhere with the belief that it actually did some crash handling. Of course the question arises: *should* we set one? I don't think so: - clangd used to crash a lot, now it's pretty stable, because we found and fixed the crashes. I think the long-term effects of crashing hard are good. - the implementation can't do any magic, it just uses longjmp to return without running any destructors by default. This is unsafe in general (e.g. mutexes won't unlock) and will certainly end up leaking memory. Whatever UB caused the crash may still stomp all over global state, etc. I think there's an argument for isolating the background indexer (autoindex) because it's not directly under the user's control, the crash surface is larger, and it doesn't particularly need to interact with the rest of clangd. But there, fork() and communicate through the FS is safer. Reviewers: ioeric, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53034 llvm-svn: 344245
* Fix the qualification of `IntrusiveRefCntPtr` to use `llvm::`.Chandler Carruth2018-10-111-2/+4
| | | | | | | | Without this, the code only compiled if the header was included after something introduced the alias from `clang::` to `llvm::` for this type. Any modules build would fail here. llvm-svn: 344225
* Lift VFS from clang to llvm (NFC)Jonas Devlieghere2018-10-1022-82/+88
| | | | | | | | | | | | | | | | | | | This patch moves the virtual file system form clang to llvm so it can be used by more projects. Concretely the patch: - Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support. - Moves the corresponding unit test from clang to llvm. - Moves the vfs namespace from clang::vfs to llvm::vfs. - Formats the lines affected by this change, mostly this is the result of the added llvm namespace. RFC on the mailing list: http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html Differential revision: https://reviews.llvm.org/D52783 llvm-svn: 344140
* [clangd] Make FSProvider const-correct. NFCSam McCall2018-10-105-11/+12
| | | | llvm-svn: 344118
* [clang-tidy] Fix handling of parens around new expressions in ↵Alexander Kornienko2018-10-094-24/+61
| | | | | | | | | | | | | | | | | | make_<smartptr> checks. Summary: Extra parentheses around a new expression result in incorrect code after applying fixes. Reviewers: hokein Reviewed By: hokein Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D52989 llvm-svn: 344058
* [clang-move] Fix broken json output.Eric Liu2018-10-091-3/+4
| | | | llvm-svn: 344055
* [clangd] Fix an accident change in r342999.Haojian Wu2018-10-091-1/+1
| | | | llvm-svn: 344054
* [clang-tidy] NFC fix warnings from missing bracesJonas Toth2018-10-091-5/+6
| | | | | | | | | The std::array create multiple StringRef but did not wrap them in braces. Some compilers warned for that. Adding the braces is not possible and result in a compilation error. This commit changes the array to vector which works without warning. llvm-svn: 344046
* [clangd] fix miscompiling lower_bound callJonas Toth2018-10-091-2/+3
| | | | llvm-svn: 344044
* [clangd] Mark colon as a safe character when percent-encoding.Kadir Cetinkaya2018-10-092-4/+9
| | | | | | | | | | | | | | Summary: Also change output of percent-encoding to use upper-case letters. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D53016 llvm-svn: 344033
* [clangd] Fix nondeterministic testSam McCall2018-10-091-1/+4
| | | | llvm-svn: 344030
* [clangd] Revert back to previous heuristic for diagnostic range extraction.Kadir Cetinkaya2018-10-092-8/+11
| | | | | | | | | | | | | | Summary: Also add a few new test cases and a special case into handling of empty fixit ranges that collides with location of a diag. Reviewers: sammccall, ilya-biryukov Reviewed By: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D52889 llvm-svn: 344025
* [clangd] Avoid cache main file status in preamble.Eric Liu2018-10-094-6/+28
| | | | | | | | | | | | Summary: Main file can certainly change when reusing preamble. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52991 llvm-svn: 344024
* [clang-tidy][docs] Update docs for `--check-suffixes`Zinovy Nis2018-10-091-3/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D52971 llvm-svn: 344016
* [clang-tidy] The patch extends the existing command line option -check-suffix Zinovy Nis2018-10-092-29/+71
| | | | | | | | | | | | | | (with alias -check-suffixes) to accept multiple comma-separated FileCheck prefixes. Usage: // RUN: %check_clang_tidy -check-suffix=USING-C,USING-D %s misc-unused-using-decls %t -- -- ... or for the same: // RUN: %check_clang_tidy -check-suffixes=USING-C,USING-D %s misc-unused-using-decls %t -- -- ... Differential Revision: https://reviews.llvm.org/D52971 llvm-svn: 344015
OpenPOWER on IntegriCloud