Fangrui Song
e019968f51
Add lexical parent to Func
2018-02-10 20:30:27 -08:00
Fangrui Song
9a6cbafa04
Add lexical parent to Type/Var and definition_spelling->spell, definition_extent->extent
2018-02-10 20:23:46 -08:00
Fangrui Song
3ba9209eea
Add config->extension.referenceContainer
2018-02-10 18:34:34 -08:00
Fangrui Song
420e84329b
Derive SymbolRef,Use from Reference and add lexical container to func/var/type uses
2018-02-10 17:33:56 -08:00
Fangrui Song
749ecf0faa
Add {Index,Query}Family to simplify template parameters
2018-02-10 00:06:45 -08:00
Fangrui Song
c4bd7ef44b
Rename Reference members
2018-02-09 14:12:35 -08:00
Fangrui Song
4bfb5a3586
struct IndexFuncRef : Reference {};
2018-02-08 22:06:09 -08:00
Fangrui Song
2d255da07b
{Index,Query}Type::uses: Range/QueryLocation -> Reference
...
And add serialization for Reference
2018-02-08 18:26:09 -08:00
Fangrui Song
48a6f836ca
Fix SymbolRole serialization and make it hashable
2018-02-08 12:24:48 -08:00
Fangrui Song
dbdab02ff4
Change is_implicit to role in {Index,Query}FuncRef
...
Add `FileId file` to *DefDefinitionData::Def
2018-02-07 23:27:35 -08:00
Fangrui Song
e76a336f19
Remove --debug in favor of LIBCLANG_DISABLE_CRASH_RECOVERY=1
...
ci/before_deploy.sh: Use the latest libclang.so
2018-02-07 00:00:04 -08:00
Fangrui Song
a8fb2264a9
Reflect IndexFuncRef
2018-02-04 17:49:00 -08:00
Fangrui Song
217d238c78
Use clang_getCursorPrettyPrinted if CINDEX_VERSION >= 47
...
Closes #366
2018-02-04 15:23:23 -08:00
Fangrui Song
e5128d3db9
Wrap Query* references with WithGen
2018-02-03 17:44:20 -08:00
Fangrui Song
6933870962
Change symbol id from size_t to RawId (uint32_t currently)
2018-02-03 10:35:17 -08:00
Nathan Ridge
74f9be1d6f
Use symbol kind 'Parameter' for template parameters
...
Clients can distinguish between function and template parameters based
on storage class.
2018-02-01 20:07:11 -08:00
Fangrui Song
0d715e7bcf
Handle int8_t int16_t uint8_t uint16_t enum constants
...
Clean up clang_complete
2018-02-01 12:21:58 -08:00
Jacob Dufault
c98d53cfe2
Indexer now has access to |config|
2018-01-31 21:48:49 -08:00
Fangrui Song
e259bb91d3
Use string_view for lsSymbolInformation
2018-01-31 21:40:40 -08:00
Fangrui Song
6d6c1639d0
Type-dependent member access expressions
2018-01-31 21:23:00 -08:00
Fangrui Song
768f4ecb6e
Enable "Make" hack only if config->index.make_unique is true.
2018-01-31 11:10:20 -08:00
Fangrui Song
4c895bef0b
Make optional<string> {hover,comments} non-optional
2018-01-30 23:48:34 -08:00
Fangrui Song
77dca1936b
Change TypeDefDefinition::short_name from string to string_view
2018-01-30 23:01:59 -08:00
Fangrui Song
93269ecfd4
Change std::string FuncDefDefinition::short_name to ShortName()
2018-01-30 22:40:02 -08:00
Fangrui Song
41f87887bb
Change std::string VarDefDefinition::short_name to ShortName()
2018-01-30 22:04:55 -08:00
Jacob Dufault
f6a2a55209
Import pipeline improvements
...
- Cache manager is created by request
- Index is always associated with its contents
- Reduced frequently of file reads
2018-01-29 21:34:36 -08:00
Jacob Dufault
a392301be3
Format
2018-01-29 16:27:43 -08:00
Fangrui Song
b7ce3dd60a
Better template specialization
2018-01-28 23:05:51 -08:00
Fangrui Song
dc1c72ce30
Remove definition from uses for TemplateVisitor
2018-01-28 22:41:53 -08:00
Fangrui Song
777193d02f
Better template specialization
2018-01-28 18:31:11 -08:00
Fangrui Song
bdb880e0a5
Serialize VarDefDefinitionData::{parent_kind,parent_id}
2018-01-28 12:34:31 -08:00
Fangrui Song
79b60561d1
Remove CXCursor_MacroDefinition from uses
2018-01-28 11:42:40 -08:00
Fangrui Song
70bbe6c64c
Use major/minor versions for IndexFile
...
Fixes #364
2018-01-27 21:47:37 -08:00
Fangrui Song
5763201838
Remove is_type_member & VarDefDefinitionData::declaring_type
...
Rename ClangStorageClass to StorageClass
Add semantic_parent & semantic_parent_kind (but not serialized yet)
Move query.h SymbolKind to indexer.h SymbolKind and make it uint8_t
2018-01-27 20:46:06 -08:00
Fangrui Song
aeb63ce3ad
Add magic/version to "cacheFormat": "msgpack"
2018-01-27 19:21:35 -08:00
Jacob Dufault
e3d3a492d0
Return default value
2018-01-27 10:20:54 -08:00
Phil Wise
74a39e7ea8
Fix build on Ubuntu 16.04
...
On Ubuntu 16.04 I get the following compile error in release mode:
../../src/indexer.cc: In function ‘ClangStorageClass {anonymous}::GetStorageClass(CX_StorageClass)’:
../../src/indexer.cc:130:1: error: control reaches end of non-void function [-Werror=return-type]
cc1plus: all warnings being treated as errors
2018-01-27 09:03:08 -08:00
Fangrui Song
0bbabbcbd2
Move IndexVar::def::declarations to IndexVar::declarations
2018-01-26 21:50:17 -08:00
Fangrui Song
e892c23955
Change declaration to declarations in IndexVar
2018-01-26 18:21:15 -08:00
Fangrui Song
6b3673a438
Remove definition_spelling from uses in IndexVar
...
Instead, specify `include_decl = true` in GetUsesOfSymbol
2018-01-26 18:01:14 -08:00
Fangrui Song
723c78409f
Move is_operator from indexer to semantic highlighting
2018-01-26 10:08:56 -08:00
Fangrui Song
351e7b6c95
Add ClangStorageClass storage; to {Func,Var}DefDefinitionData and semantic highlighting.
...
This can be used to differentiate local/global variables, template parameters.
Also make msgpack deserialization robust.
2018-01-26 09:47:42 -08:00
Fangrui Song
50c6ed1dd3
Clean up SetTypeName
2018-01-25 22:25:19 -08:00
Fangrui Song
63b793619d
Set names in ResolveToDeclarationType and type declarations.
2018-01-25 21:38:39 -08:00
Fangrui Song
7aea052f09
Re-pick "Handle template <class T> class A" but does not assign names to templates without body
2018-01-25 12:35:59 -08:00
Jacob Dufault
7f9f6e0c6b
Revert "Handle template <class T> class A; and attribute variable uses to specialized template if exists"
...
This reverts commit 8da62430e575022e206b66bad58b376002422f32.
2018-01-25 11:46:03 -08:00
Fangrui Song
684ad961ad
Handle template <class T> class A; and attribute variable uses to specialized template if exists
2018-01-25 01:13:07 -08:00
Fangrui Song
403c892838
--debug disables libclang crash recovery
2018-01-25 00:01:30 -08:00
Fangrui Song
db1f707027
Add --debug to disable libclang crash recovery
...
We can add more debug facility later.
2018-01-24 23:32:42 -08:00
Fangrui Song
706a3d0017
Attribute enum to its underlying type's uses
2018-01-24 21:55:59 -08:00
Fangrui Song
c4e8db2964
Index namespaces as Type
2018-01-24 00:57:50 -08:00
Fangrui Song
b4e1e4fd3a
Remove enableComments
, make index.comments
default to 2, and index builtin types
2018-01-23 22:56:13 -08:00
Fangrui Song
bc28bfef45
Cleanup
2018-01-20 22:55:29 -08:00
Fangrui Song
6acea187c7
Add initialization option index.builtin_types for indexing builtin types
...
Also deprecate enableComments in favor of index.comments
Make $cquery/vars work on variables (by obtaining their types first).
This is currently the only way to list instances of builtin types.
2018-01-20 22:46:03 -08:00
Fangrui Song
b5c9e22ad1
Explicitly use std::move to make clang 3.5 compile
2018-01-20 19:19:24 -08:00
Fangrui Song
a57798154d
Explicitly use std::move to make clang 3.5 compile
2018-01-20 17:59:43 -08:00
scturtle
b8a3e089ce
Response on index error. ( #319 )
2018-01-19 23:56:49 -08:00
Chao Shen
405fd56781
Crash Hotfix.
2018-01-18 08:24:10 -08:00
Chao Shen
3132572e72
Don't give up index files of headers if the .cc/.cpp file failed.
2018-01-17 21:24:32 -08:00
Fangrui Song
ca3784db03
Don't index initializer for lambda types
2018-01-17 21:02:09 -08:00
Fangrui Song
b5761b5980
Fix textDocument/definition on #include lines
2018-01-17 12:52:37 -08:00
Fangrui Song
6746883a3b
Better inside-out syntax recognizer
2018-01-17 00:29:32 -08:00
Fangrui Song
dd84a85b75
Filter out inside-out syntax and array types for variable hover
2018-01-17 00:17:04 -08:00
Fangrui Song
bf9150f58a
Index variable initializer
2018-01-16 20:30:45 -08:00
Fangrui Song
a52d4ac61d
Show enum constants as Foo::A = 0
2018-01-16 20:01:47 -08:00
Fangrui Song
7d7e238924
enum
2018-01-16 19:09:29 -08:00
Fangrui Song
0b3ab23b25
For const qualified types, index qualified names along with initializers
2018-01-16 18:26:11 -08:00
Fangrui Song
1388e5190d
Fix gcc compile error. #297
2018-01-15 08:58:08 -08:00
Jacob Dufault
e20a6e9790
Add siphash.h, HashUSR -> HashUsr
2018-01-14 13:18:12 -08:00
Fangrui Song
da2cbe4152
USR -> Usr
2018-01-13 00:10:39 -08:00
Fangrui Song
14a213d407
Change std::string USR to uint64_t pseudorandom function (SipHash 64-bit)
2018-01-12 23:47:24 -08:00
Jacob Dufault
786ac0bc4f
Merge FileContents and FileContentsWithOffsets.
...
Also try to more aggressively load FileContents when indexing to increase reliability.
2018-01-10 21:16:46 -08:00
Jacob Dufault
54394ed868
Format
2018-01-10 18:43:01 -08:00
Fangrui Song
0e5e2a6ca5
Fix build
2018-01-10 00:21:55 -08:00
Fangrui Song
0ef5aec3fc
Initial values of variables are useful. For now, enable it for const qualified types. Qualified names may also be useful but they can not be easily combined.
...
See #260
2018-01-08 00:20:40 -08:00
Fangrui Song
ce6087978f
Use cursor extents for non-type template parameters
2018-01-07 10:53:44 -08:00
Fangrui Song
332a3b5240
Serialize {type,func}->def.kind for semantic highlighting
2018-01-07 10:22:03 -08:00
Fangrui Song
34aac56ff0
Fix non-type template parameter
2018-01-07 01:19:57 -08:00
Fangrui Song
29345f067c
Set {func,type}->def.kind
2018-01-07 01:07:39 -08:00
Fangrui Song
9dc34103d8
[indexer] Add uses of types of (non-type template parameter)
2018-01-07 00:36:12 -08:00
Fangrui Song
5809d0c436
Make Serialize accept argument SerializeFormat format
...
Rename `const char* GetString()` to GetCString and add `std::string GetString()`
WIP on serializers/msgpack.h
2018-01-06 18:01:36 -08:00
Fangrui Song
007bc5362c
Fix null pointer dereference of param.primary_file
2018-01-06 14:47:24 -08:00
scturtle
991b27899f
Show error on include position. ( #243 )
2018-01-06 09:28:55 -08:00
Fangrui Song
516b94e982
Change VarClass::cls to ClangSymbolKind::kind
...
ClangSymbolKind is ported from clang::index::SymbolKind
2018-01-05 22:43:12 -08:00
Fangrui Song
5f8e1935a6
Use cursor extent instead of cursor spelling range for CXCursor_MemberRefExpr #174
...
Members of non-concrete template types do not have useful spelling ranges (likely unexposed).
C<int> f; f.x // .x produces a MemberRefExpr which has a spelling range of `x`.
C<T> e; e.x // .x produces a MemberRefExpr which has a spelling range of `e` (weird).
To make `e.x` (MemberRefExpr with empty spelling name) able to find
definition, We use cursor extent (larger than spelling range) `e.x`. It
would be better if we could restrict the ranges to `.x` or just `x`.
Nevertheless, larger ranges are less specific, and should do no harm
because they will be overriden by more specific variable references `e`.
2018-01-03 11:02:28 -08:00
Jacob Dufault
4514e2f9ce
Silence unhandled namespace declaration warnings
2018-01-03 08:05:52 -08:00
Fangrui Song
74be57c334
Set variable_type of lambda parameters
...
Now a lambda parameter is listed in $cquery/vars of its type
2018-01-03 00:00:03 -08:00
Fangrui Song
a63297b002
Add type names to non-type template parameters
2018-01-02 22:52:40 -08:00
Fangrui Song
0539e4249b
The Little Match Ray On New Year's Eve 2017
2018-01-01 00:06:25 -08:00
Fangrui Song
cef47b13f7
Remove ResolveSpelling
2017-12-31 23:34:00 -08:00
Fangrui Song
02246a5c4b
Add ClangCursor::get_spelling_range and change some ResolveSpelling calls to get_spelling_range
2017-12-31 23:27:33 -08:00
Fangrui Song
a6496a0f8f
[indexer] Add template parameters in parameter-list to their uses
and index template template parameters
2017-12-31 22:54:52 -08:00
Fangrui Song
77e9ea1b77
Use cursor extents for is_implicit
function calls
...
cursor extents have larger ranges and less specific, thus making
them overridable by more specific (with smaller range) symbols.
Thus we do not need to hide them in query.cc:BuildFileDef
For example, the left paren in `A a(3)` jumps to the constructor.
the left paren in `A a = f()` jumps to the copy/move constructor.
2017-12-30 15:42:08 -08:00
Fangrui Song
95126bff61
In detailed_name
, remove space between *
and name
2017-12-30 13:11:55 -08:00
Fangrui Song
11aa09fac2
Don't reject macro definitions in system headers
...
Before, an assert() macro expansion jumps to __assert_fail but not
assert. This is because OnIndexReference finds a reference to __assert_fail
but VisitMacroDefinitionAndExpansions rejects the expansion.
2017-12-29 19:18:42 -08:00
Jacob Dufault
c596e55dcc
Cleanup some includes.
2017-12-29 12:00:52 -06:00
Fangrui Song
d4ce12bb9a
Add --use-clang-cxx to waf and move type printer to src/type_printer.cc
...
src/type_printer.cc demonstrates how to leverage clang C++ API.
It includes clang/**/*.h headers and CXTranslationUnit.h which resides
in clang/tools/libclang/ but is not exposed in clang/include/clang-c/
These libclang/ header files are stable and provide some struct definitions used by clang-c/ header files.
A copy of them from clang source tree is checked into libclang/ .
If you want to an early adopter,
CXXFLAGS='-std=c++11 -fno-rtti -D_GLIBCXX_USE_CXX11_ABI=0 -g' ./waf configure --variant=cxx-debug --bundled-clang=5.0.1 --use-clang-cxx
Some clang/**/*.h are unstable and should be used with caution,
in addition, Windows pre-built binaries on https://releases.llvm.org/download.html do not include C++ header files.
Thus `--use-clang-cxx` defaults to False.
2017-12-29 09:51:26 -08:00
Fangrui Song
34052fbf27
[indexer] Index some references in ClassTemplate
2017-12-28 10:53:13 -08:00
Jacob Dufault
4781e9a53d
Move tests to index_tests
2017-12-28 09:42:55 -08:00
Jacob Dufault
3ab2f2e2b7
Update formatting
2017-12-28 09:22:26 -08:00
Fangrui Song
56135f615c
[template] Attribute template parameter references to the parameter declaration. Class templates still do not work
2017-12-28 00:37:10 -08:00
Fangrui Song
cff432a223
[template] Index references to non-type template parameters
2017-12-27 23:42:56 -08:00
Fangrui Song
d7d8b820ac
[template] Index template parameter references
2017-12-27 22:58:07 -08:00
Fangrui Song
f86de0b544
function signature: blacklist "typeof "
2017-12-27 19:51:16 -08:00
Fangrui Song
6fa08b2b90
Refactor function signatures: fix infinite loop processing constructors
2017-12-27 18:51:19 -08:00
romix
8bdce31789
Produce detailed function signatures which include parameter names
2017-12-27 15:49:26 -08:00
Jacob Dufault
b8e7a5bcb3
Format code
2017-12-27 07:54:46 -08:00
romix
03b50ea3cc
Serialize decl comments and use them in GetHoverForSymbol
2017-12-24 18:01:38 -08:00
Fangrui Song
2ffc068760
Handle function calls from templates. fix #174
2017-12-24 15:12:52 -08:00
Fangrui Song
dced34dd58
Reopen #174
2017-12-24 13:28:53 -08:00
Fangrui Song
4b9bc342f5
Fix called_id
2017-12-24 10:43:32 -08:00
Fangrui Song
6a8537c2bf
Handle function references in templates. fix #174 ( #184 )
2017-12-24 10:27:17 -08:00
Fangrui Song
dd4044998d
Add TemplateVisitor to handle CXCursor_OverloadedDeclRef in templates
2017-12-24 00:35:38 -08:00
Fangrui Song
cdcf75ac84
Raise maxWorkspaceSearchResults to 500 and sort results even if the max number has been reached
2017-12-23 22:49:45 -08:00
scturtle
cb7ccbe543
Change var.def.is_* to enum.
2017-12-23 19:29:32 -06:00
Fangrui Song
646d154b9b
Better heuristics, noexcept specifier and C11 _Atomic specifier
2017-12-23 09:57:12 -08:00
Fangrui Song
156d4891c3
[hover] Better heuristics to insert function name right before the paren pair enclosing parameters ( #178 )
2017-12-23 09:29:13 -08:00
Jacob Dufault
fb491e6c6d
Format using clang format 4.0.0
2017-12-23 08:33:26 -08:00
Jacob Dufault
4aeb6acf04
Test improvements:
...
- Update files with \r\n newlines.
- Require clang 4.0.0 for running tests.
2017-12-23 07:51:34 -08:00
Chao Shen
0985613d16
Add is_global and is_member.
2017-12-23 01:00:46 -06:00
Fangrui Song
2056e44d22
Insert qualified name right before matching paren ( of last ) in function's type spelling
...
Before, function<int(int)> and (anon) mess up the function signature
2017-12-22 15:48:30 -08:00
Fangrui Song
c3c0feecb2
[indexer] Make hover
optional ( #176 )
...
On textDocument/hover requests, return `detailed_name` if `hover` is unavailable
Don't include leading `type_name` in `detailed_name` for CXIdxEntityEnumConstant, i.e. `Foo Foo::a` -> `Foo::a`
2017-12-22 14:48:55 -08:00
Fangrui Song
ba4a5e91cb
[indexer] Remove IsLocalSemanticContainer check in qualified names
2017-12-22 09:21:53 -08:00
Jacob Dufault
fd7c01796c
Do not include path in lambda detail/hover string
2017-12-22 08:59:37 -08:00
Fangrui Song
043e9a4d44
[indexer] Fix hover info of class member functions
2017-12-21 22:46:45 -08:00
Fangrui Song
ba1ca37326
[indexer] Make $cquery/base find correct overriden functions ( #169 )
2017-12-20 23:18:48 -08:00
Fangrui Song
6aefa9b114
[indexer] Handle unnamed namespaces
2017-12-20 19:52:34 -08:00
Fangrui Song
ee78b527ae
[indexer] Treat empty short_name as implicit call which should not be included in all_symbols
...
std::vector<int> a = f(); // besides f, there is an implicit move constructor vector(vector<T>&&)
We expect finding references on `f` takes us to `f`, not to `vector(vector<T>&&)`
2017-12-20 07:46:43 -08:00
Fangrui Song
cf4603c6fa
Add FileContentsWithOffsets
2017-12-18 23:05:12 -08:00
Jacob Dufault
8098e4f01d
Support multiple base functions.
2017-12-18 22:15:46 -08:00
Jacob Dufault
be961fc4f2
Add hover (instead of reusing detailed_name)
2017-12-18 21:20:00 -08:00
Fangrui Song
8897bcc54d
[indexer] Display declaration line for typedef/using. fix #141
...
GetDocumentContentInRange calls clang_tokenize, which is not easy to
handle multi-line declarations. Only display declaration lines for
one-line `typedef`/`using` now.
2017-12-18 19:30:49 -08:00
Walter Erquinigo
cb098cbfc3
test
2017-12-18 16:26:58 -08:00
Walter Erquinigo
a6cb98945e
Add obj-c support in the indexer
2017-12-18 16:26:58 -08:00
Fangrui Song
5600989a42
[indexer] Treat explicit destructor call as not is_implicit
( #159 )
...
Also fixed an unused warning.
2017-12-18 13:48:32 -08:00
Fangrui Song
9fd35db034
[indexer] Index references to system headers
2017-12-17 21:16:40 -08:00
Jacob Dufault
c0c3fc41a4
Do not emit an include in the indexer if we failed to resolve the file. Also add -resource-dir to tests.
2017-12-15 21:24:31 -08:00
Walter Erquinigo
5238c50027
objc
2017-12-15 12:02:32 -08:00
Fangrui Song
17cac3d30a
[indexer] Change macro's IndexVar::def::detail_name to its approximate definition
...
For `#define foo 3`,
Before this commit, `detail_name` was `foo` (displayed for textDocument/hover reqeusts).
It is now shown as `#define foo 3`
2017-12-13 09:35:44 -08:00
Jacob Dufault
1467526bad
Be less aggressive about indexing potential lambdas
2017-12-12 09:49:52 -08:00
Fangrui Song
17f23bf3bf
In OnIndexDeclaration, get_type_description() may return the name of a typedef and there is no (, causing insert
failing
2017-12-12 00:14:25 -08:00
Jacob Dufault
9b909b3a13
Move usr out of *Def and into Query*/Index* types.
...
I'd like to make the *Def structures optional in the future, and usr is always non-optional.
2017-12-11 23:57:44 -08:00
Jacob Dufault
2751f51956
Format
2017-12-11 21:21:03 -08:00
Fangrui Song
fb902a29b7
Add missing definition and reference info to lambda paramaters. fix #120
2017-12-11 21:06:55 -08:00
Fangrui Song
479c0c59bc
More idiomatic
2017-12-10 19:53:17 -08:00
Jacob Dufault
5d1fd4ce4d
Remove a bunch of std::cerr in favor of LOG_S
2017-12-01 17:04:39 -08:00
Jacob Dufault
fa240e3132
Small code cleanup in src/indexer.cc.
2017-12-01 09:57:03 -08:00
Jacob Dufault
9b44bf7901
Run ./format.sh
2017-12-01 09:55:41 -08:00
Jacob Dufault
066166ba40
Add --clang-sanity-check.
...
Does a simple index test to verify expected libclang API behavior.
2017-12-01 09:46:40 -08:00
topisani
c4ada3e9df
Don't highlight operators as functions ( #104 )
...
* Don't highlight operators as functions
* address comments
2017-12-01 17:08:19 +01:00