aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-11-15Creating branches/google/testing and tags/google/testing/2017-11-14 from r317716testingDavid L. Jones
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/branches/google/testing@318248 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10Creating branches/google/testing and tags/google/testing/ from r317203David L. Jones
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/branches/google/testing@317856 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Relax definitions.test to accept windows file paths.Sam McCall
Reviewers: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39797 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317692 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08[clang-tidy] Add a note about modernize-replace-random-shuffleKrasimir Georgiev
Summary: This adds a note warning the users that the way the suggested fix seeds the random number generator is poor. Reviewers: hokein Reviewed By: hokein Subscribers: cfe-commits, xazax.hun Differential Revision: https://reviews.llvm.org/D39787 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317689 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08[clangd] tolerate windows filepaths in testsSam McCall
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317686 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08[clangd] loosen tests for flag-dependence revealed by r317670Sam McCall
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317673 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08[clangd] Sort completion results.Sam McCall
Summary: This is (probably) not required by LSP, but at least one buggy client wants it. It also simplifies some tests - changed a few completion tests to use -pretty. Reviewers: hokein, malaperle Subscribers: ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D39738 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317670 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Fix compile issue on MSVC.Douglas Yung
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317642 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[clangd] Fix opening declarations located in non-preamble inclusionMarc-Andre Laperle
Summary: When an inclusion is not processed as part of the preamble, its path is not made into an absolute path as part of the precompiled header code (adjustFilenameForRelocatableAST in ASTWriter.cpp). Because of this, when we convert a Decl location to retrieve the file name with FileEntry->getName(), it is possible for this path to be relative. Instead, we should try to use tryGetRealPathName first which returns an absolute path. Fixes bug 35217. Reviewers: sammccall, ilya-biryukov, rwols, Nebiroth Reviewed By: sammccall Subscribers: cfe-commits, ilya-biryukov Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D39705 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317585 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[clangd] Fix initialize capabilities responseSam McCall
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317584 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[clangd] MSVC - third time's the charmSam McCall
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317581 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[clangd] don't crash on invalid JSON-RPC IDSam McCall
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317580 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[clangd] another try at fixing MSVCSam McCall
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317575 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[clang-tidy] Misc redundant expressions checker updated for macrosGabor Horvath
Redundant Expression Checker is updated to be able to detect expressions that contain macros. Also, other small details are modified to improve the current implementation. The improvements in detail are as follows: * Binary and ternary operator expressions containing two constants, with at least one of them from a macro, are detected and tested for redundancy. Macro expressions are treated somewhat differently from other expressions, because the particular values of macros can vary across builds. They can be considered correct and intentional, even if macro values equal, produce ranges that exclude each other or fully overlap, etc. * The code structure is slightly modified: typos are corrected, comments are added and some functions are renamed to improve comprehensibility, both in the checker and the test file. A few test cases are moved to another function. * The checker is now able to detect redundant CXXFunctionalCastExprs as well. A corresponding test case is added. Patch by: Lilla Barancsuk! Differential Revision: https://reviews.llvm.org/D38688 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317570 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[clangd] Add ErrorCode enum class.Haojian Wu
Summary: Avoid using magic number in the code everywhere. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D39718 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317559 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[clangd] fix MSVC build errorsSam McCall
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317553 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07Add new check in google module for Objective-C code to ensure global ↵Haojian Wu
variables follow the naming convention of Google Objective-C Style Guide Summary: This is a new checker for objc files in clang-tidy. The new check finds global variable declarations in Objective-C files that are not follow the pattern of variable names in Google's Objective-C Style Guide. All the global variables should follow the pattern of "g[A-Z].*" (variables) or "k[A-Z].*" (constants). The check will suggest a variable name that follows the pattern if it can be inferred from the original name. Patch by Yan Zhang! Reviewers: benhamilton, hokein, alexfh Reviewed By: hokein Subscribers: Eugene.Zelenko, mgorny Differential Revision: https://reviews.llvm.org/D39391 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317552 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07ClangdTests/JSONExprTests.cpp: Appease g++-4.8 to move raw string literal ↵NAKAMURA Takumi
out of macro arg. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317538 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-06[clangd] Squash namespace warningSam McCall
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317487 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-06Adds a json::Expr type to represent intermediate JSON expressions.Sam McCall
Summary: This form can be created with a nice clang-format-friendly literal syntax, and gets escaping right. It knows how to call unparse() on our Protocol types. All the places where we pass around JSON internally now use this type. Object properties are sorted (stored as std::map) and so serialization is canonicalized, with optional prettyprinting (triggered by a -pretty flag). This makes the lit tests much nicer to read and somewhat nicer to debug. (Unfortunately the completion tests use CHECK-DAG, which only has line-granularity, so pretty-printing is disabled there. In future we could make completion ordering deterministic, or switch to unittests). Compared to the current approach, it has some efficiencies like avoiding copies of string literals used as object keys, but is probably slower overall. I think the code/test quality benefits are worth it. This patch doesn't attempt to do anything about JSON *parsing*. It takes direction from the proposal in this doc[1], but is limited in scope and visibility, for now. I am of half a mind just to use Expr as the target of a parser, and maybe do a little string deduplication, but not bother with clever memory allocation. That would be simple, and fast enough for clangd... [1] https://docs.google.com/document/d/1OEF9IauWwNuSigZzvvbjc1cVS1uGHRyGTXaoy3DjqM4/edit +cc d0k so he can tell me not to use std::map. Reviewers: ioeric, malaperle Subscribers: bkramer, ilya-biryukov, mgorny, klimek Differential Revision: https://reviews.llvm.org/D39435 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317486 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-06[clang-tidy] Support relative paths in run-clang-tidy.pyGabor Horvath
Unfortunately, these python scripts are not tested currently. I did the testing manually on LLVM by editing the CMake generated compilation database to contain relative paths for some of the files. Differential Revision: https://reviews.llvm.org/D39603 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317468 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03Use ToolExecutor framework in the sample tool-template.Eric Liu
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317333 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03[clangd] Handle clangd.applyFix server-sideMarc-Andre Laperle
Summary: When the user selects a fix-it (or any code action with commands), it is possible to let the client forward the selected command to the server. When the clangd.applyFix command is handled on the server, it can send a workspace/applyEdit request to the client. This has the advantage that the client doesn't explicitly have to know how to handle clangd.applyFix. Therefore, the code to handle clangd.applyFix in the VS Code extension (and any other Clangd client) is not required anymore. Reviewers: ilya-biryukov, sammccall, Nebiroth, hokein Reviewed By: hokein Subscribers: ioeric, hokein, rwols, puremourning, bkramer, ilya-biryukov Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D39276 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317322 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02Update release notes (check SVN commit-after-approval access)Ben Hamilton
Summary: I was just granted commit-after-approval access to SVN, and @clattner recommended I try a test commit. So, this tweaks the release notes as a test. Reviewers: hokein, alexfh Reviewed By: hokein Subscribers: Wizard Differential Revision: https://reviews.llvm.org/D39559 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317261 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02Fix clangd test on platforms where get_thread_name does nothing.Sam McCall
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317194 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02Performance tracing facility for clangd.Sam McCall
Summary: This lets you visualize clangd's activity on different threads over time, and understand critical paths of requests and object lifetimes. The data produced can be visualized in Chrome (at chrome://tracing), or in a standalone copy of catapult (http://github.com/catapult-project/catapult) This patch consists of: - a command line flag "-trace" that causes clangd to emit JSON trace data - an API (in Trace.h) allowing clangd code to easily add events to the stream - several initial uses of this API to capture JSON-RPC requests, builds, logs Example result: https://photos.app.goo.gl/12L9swaz5REGQ1rm1 Caveats: - JSON serialization is ad-hoc (isn't it everywhere?) so the API is limited to naming events rather than attaching arbitrary metadata. I'd like to fix this (I think we could use a JSON-object abstraction). - The recording is very naive: events are written immediately by locking a mutex. Contention on the mutex might disturb performance. - For now it just traces instants or spans on the current thread. There are other things that make sense to show (cross-thread flows, non-thread resources such as ASTs). But we have to start somewhere. Reviewers: ioeric, ilya-biryukov Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D39086 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317193 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02[clangd] Remove redundant installShoaib Meenai
`add_clang_tool` already adds the install command, so the one here is redundant. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317187 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02[clang-tidy] Clean up installation rulesShoaib Meenai
An installation rule for the executable with the correct component is already created by `add_clang_tool`, so the rule in this file is redundant. Correct the installation component for the Python scripts so that they also get installed by `install-clang-tidy`. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317155 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02[clang-reorder-fields] Switch to add_clang_toolShoaib Meenai
`add_clang_tool` invokes `add_clang_executable` internally, but it also takes care of setting up the install rule. It also adds an `install-*` build target, which is required for `LLVM_DISTRIBUTION_COMPONENTS`. Differential Revision: https://reviews.llvm.org/D39523 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317149 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-01Add LLVM_FALLTHROUGH to silence warning. NFCI.Simon Pilgrim
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@317083 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-28[clangd] Fix clang-tidy warnings.linaro-local/yvan.roux/B32999Benjamin Kramer
No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316832 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27[clangd] Don't crash on extremely large JSON messages.Benjamin Kramer
Found by clangd-fuzzer. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316774 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27[clangd] Harden clangd a bit against garbage input.Benjamin Kramer
There can be nullptrs here if the YAML fails to parse. Found by clangd-fuzzer! git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316770 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27[clang-tidy] Fix bug 34845, offending standard bitmask typesJonas Toth
Summary: The C++ standard allows implementations to choose the underlying type for bitmask types (e.g. std::ios_base::openmode). MSVC implemented some of them as signed integers resulting in warnings for usual code like `auto dd = std::ios_base::badbit | std::ios_base::failbit;` These false positives were reported in https://bugs.llvm.org/show_bug.cgi?id=34845 The fix allows bitwise |,&,^ for known standard bitmask types under the condition that both operands are such bitmask types. Shifting and bitwise complement are still forbidden. Reviewers: aaron.ballman, alexfh, hokein Reviewed By: aaron.ballman Subscribers: xazax.hun Differential Revision: https://reviews.llvm.org/D39099 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316767 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27[clang-tidy ObjC] [3/3] New check objc-forbidden-subclassingHaojian Wu
Summary: This is part 3 of 3 of a series of changes to improve Objective-C linting in clang-tidy. This adds a new clang-tidy check `objc-forbidden-subclassing` which ensures clients do not create subclasses of Objective-C classes which are not designed to be subclassed. (Note that for code under your control, you should use __attribute__((objc_subclassing_restricted)) instead -- this is intended for third-party APIs which cannot be modified.) By default, the following classes (which are publicly documented as not supporting subclassing) are forbidden from subclassing: ABNewPersonViewController ABPeoplePickerNavigationController ABPersonViewController ABUnknownPersonViewController NSHashTable NSMapTable NSPointerArray NSPointerFunctions NSTimer UIActionSheet UIAlertView UIImagePickerController UITextInputMode UIWebView Clients can set a CheckOption `objc-forbidden-subclassing.ClassNames` to a semicolon-separated list of class names, which overrides this list. Test Plan: `ninja check-clang-tools` Patch by Ben Hamilton! Reviewers: hokein, alexfh Reviewed By: hokein Subscribers: saidinwot, Wizard, srhines, mgorny, xazax.hun Differential Revision: https://reviews.llvm.org/D39142 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316744 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26[clangd] Report an error on findDefinitions/signatureHelp on an unopened ↵Benjamin Kramer
file instead of crashing. Found by clangd-fuzzer. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316659 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26[clangd] Don't crash on empty textDocument/didChange.Benjamin Kramer
Found by clangd-fuzzer. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316652 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26[clangd] Don't use /// for non-doxygen comments.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316650 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26[clangd] Add a simple fuzzer. It crashes a lot :)Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316649 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26[clang-tidy ObjC] [2/3] Support non-C++ files in ClangTidyTestHaojian Wu
Summary: This is part 2 of 3 of a series of changes to improve Objective-C linting in clang-tidy. Currently, `clang::tidy::test::runCheckOnCode()` assumes all files are C++ and unconditionally adds `-std=c++11` to the list of `clang-tidy` options. This updates the logic to check the extension of the source file and only add `-std=c++11` if the extension indicates C++ or Objective-C++. Depends On D39188 Test Plan: ninja ClangTidyTests && \ ./tools/clang/tools/extra/unittests/clang-tidy/ClangTidyTests Patch by Ben Hamilton! Reviewers: hokein, alexfh Reviewed By: hokein Subscribers: Wizard Differential Revision: https://reviews.llvm.org/D39189 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316645 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26[clang-tidy ObjC] [1/3] New module `objc` for Objective-C checksHaojian Wu
Summary: This is part 1 of 3 of a series of changes to improve Objective-C linting in clang-tidy. This introduces a new clang-tidy module, `objc`, specifically for Objective-C / Objective-C++ checks. The module is currently empty; D39142 adds the first check. Test Plan: `ninja check-clang-tools` Patch by Ben Hamilton! Reviewers: hokein, alexfh Reviewed By: hokein Subscribers: Wizard, mgorny Differential Revision: https://reviews.llvm.org/D39188 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316643 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25Handle PragmaDebug in PPChainedCallbacksAlex Lorenz
The test is in clang-tools-extra/test/pp-trace git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316621 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[clangd] Added a callback-based codeComplete in clangd.Ilya Biryukov
Reviewers: klimek, bkramer, sammccall, krasimir Reviewed By: sammccall Subscribers: rwols, cfe-commits Differential Revision: https://reviews.llvm.org/D38629 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316565 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[clangd] Handle exit notification (proper shutdown)Ilya Biryukov
Summary: This changes the onShutdown handler to do essentially nothing (for now), and instead exits the runloop when we receive the exit notification from the client. Some clients may wait on the reply from the shutdown request before sending an exit notification. If we exit the runloop already in the shutdown request, a client might block forever. This also gives us the opportunity to do any global cleanups and/or serializations of PCH preambles to disk, but I've left that out for now. See the LSP protocol documentation for details. Reviewers: malaperle, krasimir, bkramer, sammccall, ilya-biryukov Reviewed By: malaperle, sammccall, ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38939 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316564 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-23[clangd] Allow to pass code completion opts to ClangdServer.Ilya Biryukov
Reviewers: bkramer, krasimir, sammccall Reviewed By: krasimir Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D38731 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316327 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-23[clangd] Updated outdated test comment. NFC.Ilya Biryukov
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316323 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-23[clangd] Report proper kinds for 'Keyword' and 'Snippet' completion items.Ilya Biryukov
Reviewers: rwols, malaperle, krasimir, bkramer, sammccall Reviewed By: rwols, sammccall Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D38720 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316311 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-21clang-tidy: Fix deps.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316260 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20[clang-tidy] Remove MSVC inline assembly test from cross-plat test.Zachary Turner
This originally started out here in dev, but I moved it to another file when it became clear this wouldn't work on non-Windows. Unfortunately I forgot to remove it from this file. Test is still live, just in another source file. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316247 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20[clang-tidy] Don't error on MS-style inline assembly.Zachary Turner
To get MS-style inline assembly, we need to link in the various backends. Some other clang tools already do this, and this issue has been raised with clang-tidy several times, indicating there is sufficient desire to make this work. Differential Revision: https://reviews.llvm.org/D38549 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316246 91177308-0d34-0410-b5e6-96231b3b80d8