Commit Graph

13 Commits

Author SHA1 Message Date
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Ilya Biryukov f2001aa743 [clangd] Remove 'using namespace llvm' from .cpp files. NFC
The new guideline is to qualify with 'llvm::' explicitly both in
'.h' and '.cpp' files. This simplifies moving the code between
header and source files and is easier to keep consistent.

llvm-svn: 350531
2019-01-07 15:45:19 +00:00
Eric Liu 4fac50e72f [clangd] Tune down scope boost for global scope
Summary:
This improves cross-namespace completions and has ignorable
impact on other completion types.

Metrics
```
==================================================================================================
                                        OVERALL (excl. CROSS_NAMESPACE)
==================================================================================================
  Total measurements: 109367 (-6)
  All measurements:
	MRR: 68.11 (+0.04)	Top-1: 58.59% (+0.03%)	Top-5: 80.00% (+0.01%)	Top-100: 95.92% (-0.02%)
  Full identifiers:
	MRR: 98.35 (+0.09)	Top-1: 97.87% (+0.17%)	Top-5: 98.96% (+0.01%)	Top-100: 99.03% (+0.00%)
  Filter length 0-5:
	MRR:      23.20 (+0.05)		58.72 (+0.01)		70.16 (-0.03)		73.44 (+0.03)		76.24 (+0.00)		80.79 (+0.14)
	Top-1:    11.90% (+0.03%)		45.07% (+0.03%)		58.49% (-0.05%)		62.44% (-0.02%)		66.31% (-0.05%)		72.10% (+0.07%)
	Top-5:    35.51% (+0.08%)		76.94% (-0.01%)		85.10% (-0.13%)		87.40% (-0.02%)		88.65% (+0.01%)		91.84% (+0.17%)
	Top-100:  83.25% (-0.02%)		96.61% (-0.15%)		98.15% (-0.02%)		98.43% (-0.01%)		98.53% (+0.01%)		98.66% (+0.02%)

==================================================================================================
                                        CROSS_NAMESPACE
==================================================================================================
  Total measurements: 17702 (+27)
  All measurements:
	MRR: 28.12 (+3.26)	Top-1: 21.07% (+2.70%)	Top-5: 35.11% (+4.48%)	Top-100: 74.31% (+1.02%)
  Full identifiers:
	MRR: 79.20 (+3.72)	Top-1: 71.78% (+4.86%)	Top-5: 88.39% (+2.84%)	Top-100: 98.99% (+0.00%)
  Filter length 0-5:
	MRR:      0.92 (-0.10)		5.51 (+0.57)		18.30 (+2.34)		21.62 (+3.76)		32.00 (+6.00)		41.55 (+7.61)
	Top-1:    0.56% (-0.08%)		2.44% (+0.15%)		9.82% (+1.47%)		12.59% (+2.16%)		21.17% (+4.47%)		30.05% (+6.72%)
	Top-5:    1.20% (-0.15%)		7.14% (+1.04%)		25.17% (+3.91%)		29.74% (+5.90%)		43.29% (+9.59%)		54.75% (+9.79%)
	Top-100:  5.49% (-0.01%)		56.22% (+2.59%)		86.69% (+1.08%)		89.03% (+2.04%)		93.74% (+0.78%)		96.99% (+0.59%)
```

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D54851

llvm-svn: 347548
2018-11-26 12:12:01 +00:00
Sam McCall c008af6466 [clangd] Namespace style cleanup in cpp files. NFC.
Standardize on the most common namespace setup in our *.cpp files:
  using namespace llvm;
  namespace clang {
  namespace clangd {
  void foo(StringRef) { ... }
And remove redundant llvm:: qualifiers. (Except for cases like
make_unique where this causes problems with std:: and ADL).

This choice is pretty arbitrary, but some broad consistency is nice.
This is going to conflict with everything. Sorry :-/

Squash the other configurations:

A)
  using namespace llvm;
  using namespace clang;
  using namespace clangd;
  void clangd::foo(StringRef);
This is in some of the older files. (It prevents accidentally defining a
new function instead of one in the header file, for what that's worth).

B)
  namespace clang {
  namespace clangd {
  void foo(llvm::StringRef) { ... }
This is fine, but in practice the using directive often gets added over time.

C)
  namespace clang {
  namespace clangd {
  using namespace llvm; // inside the namespace
This was pretty common, but is a bit misleading: name lookup preferrs
clang::clangd::foo > clang::foo > llvm:: foo (no matter where the using
directive is).

llvm-svn: 344850
2018-10-20 15:30:37 +00:00
Eric Liu 3fac4ef1fd [clangd] Support scope proximity in code completion.
Summary:
This should make all-scope completion more usable. Scope proximity for
indexes will be added in followup patch.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D53131

llvm-svn: 344688
2018-10-17 11:19:02 +00:00
Eric Liu 0c29722c60 [clangd] Allow disble down traversals from root.
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
2018-10-16 10:41:17 +00:00
Fangrui Song 8380c9e918 [clangd] Migrate to LLVM STLExtras range API
llvm-svn: 343946
2018-10-07 17:21:08 +00:00
Kirill Bobyrev c38b3f0308 NFC: Fix build failure after rL341182
Didn't rename another variable reference.

llvm-svn: 341184
2018-08-31 08:29:48 +00:00
Kirill Bobyrev c1bb7b9ec4 [NFC] Use LLVM naming conventions within FileDistance
Reviewed by: sammccall

Differential Revision: https://reviews.llvm.org/D51527

llvm-svn: 341182
2018-08-31 08:19:50 +00:00
Sam McCall bed5885d9e [clangd] Upgrade logging facilities with levels and formatv.
Summary:
log() is split into four functions:
 - elog()/log()/vlog() have different severity levels, allowing filtering
 - dlog() is a lazy macro which uses LLVM_DEBUG - it logs to the logger, but
   conditionally based on -debug-only flag and is omitted in release builds

All logging functions use formatv-style format strings now, e.g:
  log("Could not resolve URI {0}: {1}", URI, Result.takeError());

Existing log sites have been split between elog/log/vlog by best guess.

This includes a workaround for passing Error to formatv that can be
simplified when D49170 or similar lands.

Subscribers: ilya-biryukov, javed.absar, ioeric, MaskRay, jkorous, cfe-commits

Differential Revision: https://reviews.llvm.org/D49008

llvm-svn: 336785
2018-07-11 10:35:11 +00:00
Sam McCall 12bee938a2 [clangd] FileDistance: missing constexpr
llvm-svn: 336246
2018-07-04 08:52:13 +00:00
Sam McCall 7c96bb6e2f [clangd] FileDistance: don't add duplicate edges
llvm-svn: 336242
2018-07-04 08:27:28 +00:00
Sam McCall 3f0243fdaf [clangd] Incorporate transitive #includes into code complete proximity scoring.
Summary:
We now compute a distance from the main file to the symbol header, which
is a weighted count of:
 - some number of #include traversals from source file --> included file
 - some number of FS traversals from file --> parent directory
 - some number of FS traversals from parent directory --> child file/dir
This calculation is performed in the appropriate URI scheme.

This means we'll get some proximity boost from header files in main-file
contexts, even when these are in different directory trees.

This extended file proximity model is not yet incorporated in the index
interface/implementation.

Reviewers: ioeric

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, cfe-commits

Differential Revision: https://reviews.llvm.org/D48441

llvm-svn: 336177
2018-07-03 08:09:29 +00:00