summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Add the missing dependency on `clangLex`.Michael Liao2019-10-162-0/+2
| | | | llvm-svn: 375039
* [clangd] Add RemoveUsingNamespace tweak.Utkarsh Saxena2019-10-165-17/+459
| | | | | | | | | | | | | | | | | | Summary: Removes the 'using namespace' under the cursor and qualifies all accesses in the current file. E.g.: using namespace std; vector<int> foo(std::map<int, int>); Would become: std::vector<int> foo(std::map<int, int>); Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68562 llvm-svn: 374982
* [clangd][NFC] Update comments to use triple-slashesKadir Cetinkaya2019-10-151-3/+4
| | | | llvm-svn: 374901
* [clangd] Propagate main context into ClangdServerKadir Cetinkaya2019-10-152-9/+22
| | | | | | | | | | | | | | | | | | | | Summary: Currently clangd initializes the ClangdServer lazily during onInitialize request, and it results in propagation of caller's context rather than the main context created ClangdLSPServer. This patch changes the logic to store main context that created ClangdLSPServer and pass it onto to ClangdServer and other objects like CDBs. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68978 llvm-svn: 374892
* [clang-tools-extra] Fix overzealous linking of dylib to clangTidyMichal Gorny2019-10-151-1/+1
| | | | | | | | | | | | | | Fix accidentally making clangTidy library link to dylib. This causes libclang.so to also link to dylib which results in duplicate symbols from shared and static libraries, and effectively to registering command-line options twice. Thanks to Sylvestre Ledru for noticing this and tracking it down to r373786. Fixes PR#43589. Differential Revision: https://reviews.llvm.org/D68927 llvm-svn: 374885
* [clang-scan-deps] Support for clang --analyze in clang-scan-depsJan Korous2019-10-141-4/+3
| | | | | | | | | | | | | | | The goal is to have 100% fidelity in clang-scan-deps behavior when --analyze is present in compilation command. At the same time I don't want to break clang-tidy which expects __static_analyzer__ macro defined as built-in. I introduce new cc1 options (-setup-static-analyzer) that controls the macro definition and is conditionally set in driver. Differential Revision: https://reviews.llvm.org/D68093 llvm-svn: 374815
* [clangd] Improve semantic highlighting in dependent contexts (fixes #154)Nathan Ridge2019-10-144-5/+119
| | | | | | | | | | | | Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67901 llvm-svn: 374799
* clangd tests: use extended regex with sedNico Weber2019-10-143-3/+3
| | | | | | | | | The escaped parens seem to confuse the combination of lit, cygwin quoting, and cygwin's sed. unxutils sed in cmd.exe is fine with both forms, so use the extended regex form that doesn't need an escaped paren. llvm-svn: 374753
* convert another test to unix line endingsNico Weber2019-10-141-14/+14
| | | | llvm-svn: 374752
* convert a test to unix line endingsNico Weber2019-10-141-84/+84
| | | | llvm-svn: 374751
* fix typo in 374747Nico Weber2019-10-141-1/+1
| | | | llvm-svn: 374750
* Prefer 'env not' over 'not env' in tests.Nico Weber2019-10-141-1/+1
| | | | | | | | | That way, lit's builtin 'env' command can be used for the 'env' bit. Also it's clearer that way that the 'not' shouldn't cover 'env' failures. llvm-svn: 374749
* Make symbols.test pass on Windows.Nico Weber2019-10-142-2/+2
| | | | | | | | See commit message of r374746 for details. Hopefully final bit of PR43592. llvm-svn: 374747
* Make code-action-request.test and request-reply.test pass on Windows.Nico Weber2019-10-142-5/+5
| | | | | | | | | | | | clangd's test:// scheme expands to /clangd-test on non-Win and to C:/clang-test on Win, so it can't be mixed freely with file:///clangd-test since that's wrong on Windows. This makes both tests consistenly use the test:// scheme. (Alternatively, we could use the //INPUT_DIR pattern used in a few other tests.) Part of PR43592. llvm-svn: 374746
* Don't run background-index.test on Windows.Nico Weber2019-10-141-1/+1
| | | | | | | | | The test had a "UNSUPPORTED: win32" line, but the spelling of that changed in r339307 a year ago. Finally update this test too. Part of PR43592. llvm-svn: 374745
* Add missing "REQUIRES: shell" to system-include-extractor.testNico Weber2019-10-131-0/+3
| | | | | | Part of PR43592. llvm-svn: 374730
* Make the last to clangd unit tests pass on Windows.Nico Weber2019-10-131-2/+8
| | | | | | | | | | (Some lit tests still fail.) See FIXME in diff for details. Part of PR43592. llvm-svn: 374727
* Make most clangd unittests pass on WindowsNico Weber2019-10-138-7/+57
| | | | | | | | | | | | | | | | | | | | The Windows triple currently turns on delayed template parsing, which confuses several unit tests that use templates. For now, just explicitly disable delayed template parsing. This isn't ideal, but: - the Windows triple will soon no longer use delayed template parsing by default - there's precedent for this in the clangd unit tests already - let's get the clangd tests pass on Windows first before making behavioral changes Part of PR43592. llvm-svn: 374718
* [clang-tidy] bugprone-not-null-terminated-result: checker adjustments 4Csaba Dabis2019-10-131-1/+1
| | | | llvm-svn: 374715
* [clang-tidy] bugprone-not-null-terminated-result: checker adjustments 3Csaba Dabis2019-10-132-0/+10
| | | | | | | On Windows the signed/unsigned int conversions of APInt seems broken, so that two of the test files marked as unsupported on Windows, as a hotfix. llvm-svn: 374713
* [clang-tidy] bugprone-not-null-terminated-result: checker adjustments 2Csaba Dabis2019-10-131-7/+8
| | | | llvm-svn: 374712
* [clang-tidy] bugprone-not-null-terminated-result: checker adjustmentsCsaba Dabis2019-10-131-6/+6
| | | | llvm-svn: 374711
* [clang-tidy] bugprone-not-null-terminated-result: Sphinx adjustments 2Csaba Dabis2019-10-131-17/+21
| | | | llvm-svn: 374710
* [clang-tidy] bugprone-not-null-terminated-result: Sphinx adjustmentsCsaba Dabis2019-10-131-15/+16
| | | | llvm-svn: 374709
* [clang-tidy] New checker for not null-terminated result caused by strlen(), ↵Csaba Dabis2019-10-1317-0/+2168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | size() or equal length Summary: New checker called bugprone-not-null-terminated-result. This checker 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 and their respective `wchar_t` based functions are checked: `memcpy`, `memcpy_s`, `memchr`, `memmove`, `memmove_s`, `strerror_s`, `strncmp`, `strxfrm` 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 not enough to hold the null terminator. ``` static char *stringCpy(const std::string &str) { char *result = reinterpret_cast<char *>(malloc(str.size())); memcpy(result, str.data(), str.size()); return result; } ``` In addition to issuing warnings, fix-it rewrites all the necessary code. It also tries to adjust the capacity of the destination array: ``` static char *stringCpy(const std::string &str) { char *result = reinterpret_cast<char *>(malloc(str.size() + 1)); strcpy(result, str.data()); return result; } ``` Note: It cannot guarantee to rewrite every of the path-sensitive memory allocations. Reviewed By: JonasToth, aaron.ballman, whisperity, alexfh Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D45050 llvm-svn: 374707
* Updated add_new_check.py to create checker tests in the new directoryDmitri Gribenko2019-10-111-1/+1
| | | | llvm-svn: 374551
* [ClangTidy] Separate tests for infrastructure and checkers, fixupDmitri Gribenko2019-10-111-0/+0
| | | | | | Renamed a file that I missed in r374540. llvm-svn: 374549
* [ClangTidy] Separate tests for infrastructure and checkersDmitri Gribenko2019-10-11564-0/+0
| | | | | | | | | | | | | | | | | | | | Summary: This change moves tests for checkers and infrastructure into separate directories, making it easier to find infrastructure tests. Tests for checkers are already easy to find because they are named after the checker. Tests for infrastructure were difficult to find because they were outnumbered by tests for checkers. Now they are in a separate directory. Reviewers: jfb, jdoerfert, lebedev.ri Subscribers: srhines, nemanjai, aheejin, kbarton, christof, mgrang, arphaman, jfb, lebedev.ri, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68807 llvm-svn: 374540
* Get ClangdXPC.framework building (barely) with CMake's Xcode generatorJordan Rose2019-10-111-2/+2
| | | | | | | | | | | | | | | | | | | The output directories for CMake's Xcode project generator are specific to the configuration, and so looking in CMAKE_LIBRARY_OUTPUT_DIRECTORY isn't going to work. Fortunately, CMake already provides generator expressions to find the output of a given target. I call this "barely" building because the built framework isn't going to respect the configuration; that is, I can't have both Debug and RelWithDebInfo variants of ClangdXPC.framework at the same time like I can with normal library or executable targets. To do that we'd have to put the framework in a configuration-specific output directory or use CMake's native support for frameworks instead. https://reviews.llvm.org/D68846 llvm-svn: 374494
* [libTooling] Move Transformer files to their own directory/library.Yitzhak Mandelbaum2019-10-104-6/+6
| | | | | | | | | | | | | | | | | | | Summary: The Transformer library has been growing inside of lib/Tooling/Refactoring. However, it's not really related to anything else in that directory. This revision moves all Transformer-related files into their own include & lib directories. A followup revision will (temporarily) add forwarding headers to help any users migrate their code to the new location. Reviewers: gribozavr Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68637 llvm-svn: 374271
* [clangd] Make sure ReplyCallbacks are destroyed before RequestCancelersMutexKadir Cetinkaya2019-10-091-10/+13
| | | | | | | | | | | | | | | | | Summary: After rL374163, replycallbacks might have a cancellable context, which will try to access RequestCancellers on destruction. See http://45.33.8.238/mac/1245/step_7.txt for a sample failure. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits, thakis Tags: #clang Differential Revision: https://reviews.llvm.org/D68702 llvm-svn: 374168
* [clangd] Propagate context into reply handlersKadir Cetinkaya2019-10-091-1/+1
| | | | llvm-svn: 374163
* Try to get readability-deleted-default.cpp to pass on Windows.Nico Weber2019-10-081-2/+19
| | | | | | | | | | | | | | | In MS compatibility mode, "extern inline void g()" is not a redundant declaration for "inline void g()", because of redeclForcesDefMSVC() (see PR19264, r205485). To fix, run the test with -fms-compatiblity forced on and off and explicit check for the differing behavior for extern inline. Final bit of PR43593. Differential Revision: https://reviews.llvm.org/D68640 llvm-svn: 374103
* [clangd] Disable expand auto on decltype(auto)Ilya Biryukov2019-10-082-1/+5
| | | | | | | | | | | | | | | | Summary: Applying it produces incorrect code at the moment. Reviewers: sammccall Reviewed By: sammccall Subscribers: kuhnel, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68630 llvm-svn: 374048
* [clangd] Bump timeouts in speculative completion testsKadir Cetinkaya2019-10-081-1/+1
| | | | llvm-svn: 374047
* Attempt to fix a few clang-tidy tests on Windows, see PR43593.Nico Weber2019-10-074-4/+4
| | | | llvm-svn: 373951
* Try to get clangd tests passing on Windows.Nico Weber2019-10-072-10/+10
| | | | | | Part of PR43592. See also r328645. llvm-svn: 373932
* [clangd] Fix raciness in code completion testsKadir Cetinkaya2019-10-071-11/+19
| | | | | | | | | | | | Reviewers: sammccall, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68273 llvm-svn: 373924
* [clangd] Catch an unchecked "Expected<T>" in HeaderSourceSwitch.Haojian Wu2019-10-074-3/+12
| | | | | | | | | | | | | | Summary: Also fixes a potential user-after-scope issue of "Path". Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68564 llvm-svn: 373897
* [clangd] If an undocumented definition exists, don't accept documentation ↵Sam McCall2019-10-072-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | from other forward decls. Summary: This fixes cases like: foo.h class Undocumented{} bar.h // break an include cycle. we should refactor this! class Undocumented; Where the comment doesn't describe the class. Note that a forward decl that is *visible to the definition* will still have its doc comment used, by SymbolCollector: Merge isn't involved here. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68467 llvm-svn: 373892
* [clangd] Collect missing macro references.Haojian Wu2019-10-072-2/+38
| | | | | | | | | | | | | | Summary: Semantic highlghting is missing a few macro references. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68458 llvm-svn: 373889
* [clang-tools-extra] [cmake] Link against libclang-cpp whenever possibleMichal Gorny2019-10-0427-51/+120
| | | | | | | | | Use clang_target_link_libraries() in order to support linking against libclang-cpp instead of static libraries. Differential Revision: https://reviews.llvm.org/D68448 llvm-svn: 373786
* [clangd] update the package-lock.json.Haojian Wu2019-10-041-364/+380
| | | | llvm-svn: 373739
* [CodeComplete] Ensure object is the same in compareOverloads()Ilya Biryukov2019-10-041-0/+19
| | | | | | | | | | | | | | | | | | Summary: This fixes a regression that led to size() not being available in clangd when completing 'deque().^' and using libc++. Reviewers: sammccall Reviewed By: sammccall Subscribers: jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68335 llvm-svn: 373710
* [clang-tools-extra] [cmake] Use add_clang_tool() to install toolsMichal Gorny2019-10-047-19/+5
| | | | | | | | | | | | Replace add_clang_executable() calls with add_clang_tool() that takes care of creating correct, distribution-friendly install target. While at it, remove redundant install calls. This change also causes clang-move and pp-trace to be installed. Differential Revision: https://reviews.llvm.org/D68423 llvm-svn: 373694
* Add the misc-init-local-variables check.Aaron Ballman2019-10-028-6/+292
| | | | | | | | This checks finds all primitive type local variables (integers, doubles, pointers) that are declared without an initial value. Includes fixit functionality to initialize said variables with a default value. This is zero for most types and NaN for floating point types. The use of NaNs is copied from the D programming language. Patch by Jussi Pakkanen. llvm-svn: 373489
* [Clangd] ExtractFunction: Don't extract body of enclosing function.Shaurya Gupta2019-10-022-8/+28
| | | | | | | | | | | | | | | | | | | Summary: This patch disable extraction of the body of the enclosing function. `void f() [[{}]]` Extracting this CompoundStmt would leave the enclosing function without a body. Reviewers: sammccall, kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68245 llvm-svn: 373472
* [Clangd] Ensure children are always RootStmt in ExtractFunction (Fixes #153)Shaurya Gupta2019-10-022-4/+17
| | | | | | | | | | | | | | | | | | Summary: We weren't always checking if children are RootStmts in ExtractFunction. For `void f([[int a]]);`, the ParmVarDecl appeared as a RootStmt since we didn't perform the check and ended up being casted to a (null) Stmt. Reviewers: sammccall, kadircet Subscribers: kristof.beyls, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68182 llvm-svn: 373471
* [clangd] Bail out early if we are sure that the symbol is used outside of ↵Haojian Wu2019-10-022-19/+31
| | | | | | | | | | | | | | | | | | the file. Summary: This would reduce the false positive when the static index is in an unavailable state, e.g. background index is not finished. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68325 llvm-svn: 373444
* [clangd] SelectionTree should mark a node as fully-selected if the only ↵Sam McCall2019-10-024-27/+30
| | | | | | | | | | | | | | | | | | | claimed tokens were early-claimed. Summary: Previously they would be marked as partially-selected based on the early claim, and never updated as no more tokens were claimed. This affects simple VarDecls like "int x". Reviewers: SureYeaah Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66872 llvm-svn: 373442
OpenPOWER on IntegriCloud