summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangtidy] Remove old copy of ExprMutationAnalyzerShuai Wang2018-09-117-1324/+5
| | | | | | | | | | | | | | | | | | Summary: This is 2/2 of moving ExprMutationAnalyzer from clangtidy to clang/Analysis. ExprMutationAnalyzer is moved to clang/Analysis in D51948. This diff migrates existing usages within clangtidy to point to the new location and remove the old copy of ExprMutationAnalyzer. Reviewers: george.karpenkov, JonasToth Reviewed By: george.karpenkov Subscribers: mgorny, a.sidorin, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D51950 llvm-svn: 342006
* [clang-tidy] Handle sugared reference types in ExprMutationAnalyzerShuai Wang2018-09-112-24/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This handles cases like this: ``` typedef int& IntRef; void mutate(IntRef); void f() { int x; mutate(x); } ``` where the param type is a sugared type (`TypedefType`) instead of a reference type directly. Note that another category of similar but different cases are already handled properly before: ``` typedef int Int; void mutate(Int&); void f() { int x; mutate(x); } ``` Reviewers: aaron.ballman, alexfh, george.karpenkov Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D50953 llvm-svn: 341986
* [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzerShuai Wang2018-09-112-2/+99
| | | | | | | | | | | | | | | | | | | | | | | | Summary: For smart pointers like std::unique_ptr which uniquely owns the underlying object, treat the mutation of the pointee as mutation of the smart pointer itself. This gives better behavior for cases like this: ``` void f(std::vector<std::unique_ptr<Foo>> v) { // undesirable analyze result of `v` as not mutated. for (auto& p : v) { p->mutate(); // only const member function `operator->` is invoked on `p` } } ``` Reviewers: hokein, george.karpenkov Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D50883 llvm-svn: 341967
* Reland "Implement a (simple) Markdown generator"Julie Hockett2018-09-1113-38/+730
| | | | | | | | Relanding with fixes to tests for the failing bots. Differential Revision: https://reviews.llvm.org/D43424 llvm-svn: 341955
* [clangd] Add unittests for D51917Kadir Cetinkaya2018-09-111-0/+39
| | | | | | | | | | | | Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51924 llvm-svn: 341950
* Remove unnecessary semicolon to silence -Wpedantic warning. NFCI.Simon Pilgrim2018-09-111-1/+1
| | | | llvm-svn: 341938
* [NFC][clangd] fix warning for extra semicolonJonas Toth2018-09-111-2/+2
| | | | llvm-svn: 341933
* [clang-tidy] Insert absl::StrAppend when replacing StrCat.Benjamin Kramer2018-09-112-5/+5
| | | | | | | There might be no using decl for StrAppend around, inserting the qualified name is less likely to break things. llvm-svn: 341929
* [clang-tidy] Add a missing comma after "flags"Benjamin Kramer2018-09-114-16/+7
| | | | llvm-svn: 341925
* [clangd] NFC: Use uint32_t for FuzzyFindRequest limitsKirill Bobyrev2018-09-112-12/+10
| | | | | | | | Reviewed By: ioeric Differential Revision: https://reviews.llvm.org/D51860 llvm-svn: 341921
* Revert "Revert "[clang-tidy] Handle unresolved expressions in ↵Shuai Wang2018-09-112-10/+142
| | | | | | | | | | | ExprMutationAnalyzer"" This is the same as D50619 plus fixes for buildbot failures on windows. The test failures on windows are caused by -fdelayed-template-parsing and is fixed by forcing -fno-delayed-template-parsing on test cases that requires AST for uninstantiated templates. llvm-svn: 341891
* Revert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer"Shuai Wang2018-09-102-126/+10
| | | | | | | | | | | | | | | | | Summary: Tests somehow break on windows (and only on windows) http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/13003 http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/13747 I have yet figure out why so reverting to unbreak first. Reviewers: george.karpenkov Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D51898 llvm-svn: 341886
* [clang-tidy] ExprMutationAnalyzer: construct from references. Fixes PR38888Roman Lebedev2018-09-105-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I have hit this the rough way, while trying to use this in D51870. There is no particular point in storing the pointers, and moreover the pointers are assumed to be non-null, and that assumption is not enforced. If they are null, it won't be able to do anything good with them anyway. Initially i thought about simply adding asserts() that they are not null, but taking/storing references looks like even cleaner solution? Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=38888 | PR38888 ]] Reviewers: JonasToth, shuaiwang, alexfh, george.karpenkov Reviewed By: shuaiwang Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D51884 llvm-svn: 341854
* [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzerShuai Wang2018-09-102-10/+126
| | | | | | | | | | | | | | Summary: - If a function is unresolved, assume it mutates its arguments - Follow unresolved member expressions for nested mutations Reviewers: aaron.ballman, JonasToth, george.karpenkov Subscribers: xazax.hun, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D50619 llvm-svn: 341848
* [clangd] Unbreak buildbots after r341802Kirill Bobyrev2018-09-101-1/+1
| | | | | Solution: use std::move when returning result from toJSON(...). llvm-svn: 341832
* [clangd] Add unittests for D51038Kadir Cetinkaya2018-09-101-0/+50
| | | | | | | | | | | | Reviewers: ilya-biryukov, ioeric, hokein Reviewed By: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51039 llvm-svn: 341830
* [clangd] Implement FuzzyFindRequest JSON (de)serializationKirill Bobyrev2018-09-103-3/+33
| | | | | | | | | | | | JSON (de)serialization of `FuzzyFindRequest` might be useful for both D51090 and D51628. Also, this allows precise logging of the fuzzy find requests. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51852 llvm-svn: 341802
* [clangd] Add symbol slab size to index memory consumption estimatesKirill Bobyrev2018-09-106-19/+37
| | | | | | | | | | | | | Currently, `SymbolIndex::estimateMemoryUsage()` returns the "overhead" estimate, i.e. the estimate of the Index data structure excluding backing data (such as Symbol Slab and Reference Slab). This patch propagates information about paired data size where necessary. Reviewed By: ioeric, sammccall Differential Revision: https://reviews.llvm.org/D51539 llvm-svn: 341800
* [clangd] Fix async index loading (from r341376).Sam McCall2018-09-101-1/+4
| | | | | | | | | | | | | | | | | | | | | Summary: This wasn't actually async (due to std::future destructor blocking). If it were, we would have clean shutdown issues if main returned and destroyed Placeholder before the thread is done with it. We could attempt to avoid any blocking by using shared_ptr or weak_ptr tricks so the thread can detect Placeholder's destruction, but there are other potential issues (e.g. loadIndex does tracing, and we'll destroy the tracer...) Instead, once LSPServer::run returns, we wait for the index to finish loading before exiting. Performance is not critical in this situation. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51674 llvm-svn: 341797
* ReleaseNotes: update links to use httpsHans Wennborg2018-09-101-6/+6
| | | | llvm-svn: 341787
* [clangd] NFC: Rename DexIndex to DexKirill Bobyrev2018-09-108-78/+72
| | | | | | | | | | Also, cleanup some redundant includes. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51774 llvm-svn: 341784
* [clangd] Make advanceTo() faster on Posting ListsKirill Bobyrev2018-09-101-1/+4
| | | | | | | | | | | | If the current element is already beyond advanceTo()'s DocID, just return instead of doing binary search. This simple optimization saves up to 6-7% performance, Reviewed By: ilya-biryukov Differential Revision: https://reviews.llvm.org/D51802 llvm-svn: 341781
* [clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheckBen Hamilton2018-09-071-1/+1
| | | | | | | | | | | | | | Summary: This adds a few common acronyms we found were missing from PropertyDeclarationCheck. Reviewers: Wizard, hokein Reviewed By: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51819 llvm-svn: 341721
* [clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheckBen Hamilton2018-09-071-0/+8
| | | | | | | | | | | | Summary: This adds a few common acronyms we found were missing from PropertyDeclarationCheck. Reviewers: Wizard, hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51819 llvm-svn: 341720
* [clangd] Canonicalize include paths in clangd.Eric Liu2018-09-0712-24/+24
| | | | | | Get rid of "../" and "../../". llvm-svn: 341645
* [clang-tidy] Abseil: Allow macros inside of absl to use internal absl thingsBenjamin Kramer2018-09-073-1/+11
| | | | llvm-svn: 341643
* [clangd] NFC: Document URIDistanceKirill Bobyrev2018-09-071-0/+1
| | | | | | | | | | | | | `URIDistance` constructor should mention that `Sources` must contain *absolute paths*, not URIs. This is not very clear when looking at the interface, especially given that `distance(...)` accepts `URI`, not an absolute path which can give the wrong impression. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51691 llvm-svn: 341639
* Fix reported range of partial token replacementStephen Kelly2018-09-061-5/+5
| | | | | | | | | | | | Summary: Fixes bug: 38678 Reviewers: klimek, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51192 llvm-svn: 341583
* [clangd] Add "Deprecated" field to Symbol and CodeCompletion.Eric Liu2018-09-0616-25/+119
| | | | | | | | | | | | | | Summary: Also set "deprecated" field in LSP CompletionItem. Reviewers: sammccall, kadircet Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51724 llvm-svn: 341576
* [clangd] Fix Dex initializationKirill Bobyrev2018-09-062-3/+11
| | | | | | | | | | | | This patch sets URI schemes of Dex to SymbolCollector's default schemes in case callers tried to pass empty list of schemes. This was the case for initialization in Clangd main and was a reason of incorrect behavior. Also, it fixes a bug with missed `continue;` after spotting invalid URI scheme conversion. llvm-svn: 341552
* [clangd] NFC: Use TopN instead of std::priority_queueKirill Bobyrev2018-09-061-11/+7
| | | | | | | | | | | | | | Quality.cpp defines a structure for convenient storage of Top N items, it should be used instead of the `std::priority_queue` with slightly obscure semantics. This patch does not affect functionality. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51676 llvm-svn: 341544
* [clangd] NFC: mark single-parameter constructors explicitKirill Bobyrev2018-09-061-4/+4
| | | | | | | | | | Code health: prevent implicit conversions to user-defined types. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51690 llvm-svn: 341543
* [clangd] Implement proximity path boosting for DexKirill Bobyrev2018-09-0610-60/+283
| | | | | | | | | | | | | | | This patch introduces `PathURI` Search Token kind and utilizes it to uprank symbols which are defined in files with small distance to the directory where the fuzzy find request is coming from (e.g. files user is editing). Reviewed By: ioeric Reviewers: ioeric, sammccall Differential Revision: https://reviews.llvm.org/D51481 llvm-svn: 341542
* [clangd] Fix data race in async fuzzyFind tests.Ilya Biryukov2018-09-061-0/+4
| | | | llvm-svn: 341538
* [clangd] Set SymbolID for sema macros so that they can be merged with index ↵Eric Liu2018-09-065-13/+44
| | | | | | | | | | | | macros. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51688 llvm-svn: 341534
* [clang-tidy] minor bug fix to AbseilMatcher.hEric Liu2018-09-051-4/+13
| | | | | | | | | | | | | This missing directory is not yet released, but is causing some problems internally. It's gonna be released eventually and received permission to include it here. This matcher will also be periodically updated by my team as we have more releases and or problems internally. Patch by Hugo Gonzalez! Differential Revision: https://reviews.llvm.org/D51699 llvm-svn: 341488
* [clangd] Fix type/variable name conflict on some compilersSam McCall2018-09-051-9/+8
| | | | llvm-svn: 341467
* [clangd] Fix references.test assertionsSam McCall2018-09-051-3/+3
| | | | llvm-svn: 341466
* [clangd] make zlib compression optional for binary formatSam McCall2018-09-051-11/+29
| | | | llvm-svn: 341465
* [clangd] Sort GoToDefinition results.Haojian Wu2018-09-052-33/+127
| | | | | | | | | | | | | | | | | | | | | | | Summary: GoToDefinition returns all declaration results (implicit/explicit) that are in the same location, and the results are returned in arbitrary order. Some LSP clients defaultly take the first result as the final result, which might present a bad result (implicit decl) to users. This patch ranks the result based on whether the declarations are referenced explicitly/implicitly. We put explicit declarations first. This also improves the "hover" (which just take the first result) feature in some cases. Reviewers: ilya-biryukov Subscribers: kadircet, ioeric, MaskRay, jkorous, mgrang, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D50438 llvm-svn: 341463
* [clangd] Add xrefs LSP boilerplate implementation.Sam McCall2018-09-0512-35/+84
| | | | | | | | | | Reviewers: ilya-biryukov, ioeric Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D50896 llvm-svn: 341462
* [clangd] Avoid enum class+enumValN to avoid GCC bug(?), and use consistent ↵Sam McCall2018-09-052-12/+3
| | | | | | style. llvm-svn: 341459
* [clangd] Implement findReferences functionSam McCall2018-09-054-80/+268
| | | | | | clangd will use findReferences to provide LSP's reference feature. llvm-svn: 341458
* [clangd] Fix typo. NFCFangrui Song2018-09-054-4/+4
| | | | llvm-svn: 341452
* [clangd] Fix buildbot failures on older compilers from r341375Sam McCall2018-09-052-7/+7
| | | | llvm-svn: 341451
* [clangd] Tune macro quality scoring for code completion.Eric Liu2018-09-051-1/+1
| | | | | | | | x0.2 seems to be too much penalty, macros might be wanted in some cases; changing to 0.5x instead. The tuning didn't affect ranking for non-macro completions. llvm-svn: 341449
* [clangd] Load static index asynchronously, add tracing.Sam McCall2018-09-043-6/+19
| | | | | | | | | | | | | | Summary: Like D51475 but simplified based on recent patches. While here, clarify that loadIndex() takes a filename, not file content. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51638 llvm-svn: 341376
* [clangd] Define a compact binary serialization fomat for symbol slab/index.Sam McCall2018-09-0414-132/+848
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is intended to replace the current YAML format for general use. It's ~10x more compact than YAML, and ~40% more compact than gzipped YAML: llvmidx.riff = 20M, llvmidx.yaml = 272M, llvmidx.yaml.gz = 32M It's also simpler/faster to read and write. The format is a RIFF container (chunks of (type, size, data)) with: - a compressed string table - simple binary encoding of symbols (with varints for compactness) It can be extended to include occurrences, Dex posting lists, etc. There's no rich backwards-compatibility scheme, but a version number is included so we can detect incompatible files and do ad-hoc back-compat. Alternatives considered: - compressed YAML or JSON: bulky and slow to load - llvm bitstream: confusing model and libraries are hard to use. My attempt produced slightly larger files, and the code was longer and slower. - protobuf or similar: would be really nice (esp for back-compat) but the dependency is a big hassle - ad-hoc binary format without a container: it seems clear we're going to add posting lists and occurrences here, and that they will benefit from sharing a string table. The container makes it easy to debug these pieces in isolation, and make them optional. Reviewers: ioeric Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51585 llvm-svn: 341375
* [clangd] NFC: Change quality type to floatKirill Bobyrev2018-09-042-2/+2
| | | | | | | | Reviewed by: sammccall Differential Revision: https://reviews.llvm.org/D51636 llvm-svn: 341374
* [clangd] Move buildStaticIndex() to SymbolYAMLKirill Bobyrev2018-09-043-23/+25
| | | | | | | | | | | | | | `buildStaticIndex()` is used by two other tools that I'm building, now it's useful outside of `tool/ClangdMain.cpp`. Also, slightly refactor the code while moving it to the different source file. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51626 llvm-svn: 341369
OpenPOWER on IntegriCloud