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
topisani
63d2b5fa10
nitpick fixing
2017-11-30 14:12:41 -08:00
topisani
4e153784f6
Index language as enum instead of string
2017-11-30 14:12:41 -08:00
topisani
e6bcd05a7e
markdown compliant language identifiers
2017-11-30 14:12:41 -08:00
topisani
28ad5b1ed1
Index file language and send it on hover
2017-11-30 14:12:41 -08:00
Jacob Dufault
601af73ca9
Move all libclangmm/* files into src/* directory
2017-11-11 11:41:09 -08:00
Jacob Dufault
348b4a2e4e
Move libclangmm/Cursor.* to clang_cursor.*
2017-11-11 11:31:05 -08:00
Jacob Dufault
9d376a47d5
Do not index is_constructor and parameter_type_descriptions.
2017-11-08 19:59:11 -08:00
Jacob Dufault
96894ae996
Index std::make_unique and similar functions as constructor calls.
2017-11-08 19:55:13 -08:00
Jacob Dufault
e7de24764e
Increase indexed file version
2017-11-07 01:01:37 -08:00
Jacob Dufault
510594cdcd
Add is_constructor to indexer
2017-11-07 01:00:59 -08:00
Jacob Dufault
9cb4008023
Index type description for function parameters.
2017-11-07 00:57:08 -08:00
Jacob Dufault
6d2af96c16
Remove TranslationUnit::document_cursor()
2017-11-04 16:11:52 -07:00
Jacob Dufault
7d549f3fdf
Move libclangmm/Utility.h into clang_utils.h
2017-11-04 16:02:39 -07:00
Jacob Dufault
7734943620
Format all code in src/
2017-10-31 12:49:19 -07:00
Jacob Dufault
3e9cffcc62
Cleanup clang::TranslationUnit API so callers have to handle failures.
2017-10-22 22:07:50 -07:00
Jacob Dufault
7531a0b4e5
Real-time indexing as you type.
2017-09-26 23:03:43 -07:00
Jacob Dufault
f5314b62b1
Reformat to Chromium style.
2017-09-21 18:14:57 -07:00
Jacob Dufault
d9143f065d
Fix indexer crash when indexing MSVC STL.
2017-09-12 22:51:13 -07:00
Jacob Dufault
7901653698
Make sure file exists before importing it.
2017-08-15 22:39:50 -07:00
Jacob Dufault
7faedfdf00
Do not import empty dependencies
2017-08-15 20:28:52 -07:00
Jacob Dufault
3ab4d0455d
Fix delta update.
...
Previous file was being loaded after the current file is written to disk.
2017-08-15 00:46:21 -07:00
Jacob Dufault
1f3f69b221
Reuse loaded file contents in indexer; clear large state before caching.
2017-07-30 11:31:41 -07:00
Jacob Dufault
ee20d79dcc
wip
2017-07-29 21:24:02 -07:00
Jacob Dufault
00e452272f
Do not use clang_Location_isInSystemHeader for diagnostics; causes crashes
2017-07-12 15:02:48 -07:00
Jacob Dufault
6ab8a27313
Mark macros in index.
2017-06-28 23:28:29 -07:00
Jacob Dufault
a005cc627d
Generate diagnostics when indexing a file, even if non-interactive.
2017-06-19 18:52:25 -07:00
Jacob Dufault
7328d138e3
Fix linker error on clang (issue #2 )
2017-06-14 20:12:52 -07:00
Jacob Dufault
0e5312790e
Add more detailed logging for failed unique file id
2017-06-13 20:08:31 -07:00
Jacob Dufault
dec484ed0d
Only report diagnostics from code completion document parse.
...
Also use shared_ptr, hopefully fix memory crashes.
2017-06-09 21:13:16 -07:00
Jacob Dufault
8c50324576
Small fixes for osx
2017-05-30 17:54:19 -07:00
Jacob Dufault
1d67d1ee37
Add additional metadata to function declarations.
2017-05-27 18:53:22 -07:00
Jacob Dufault
3469850c98
Change how function declarations are serialized so parameter info can be added.
2017-05-27 14:09:20 -07:00
Jacob Dufault
b7f7987cb8
Use cached location
2017-05-27 13:10:06 -07:00
Jacob Dufault
5415f4be50
Don't count the '~' in type usages for destructors.
2017-05-27 13:02:49 -07:00
Jacob Dufault
dcc71f2470
More cleanup in indexer
2017-05-27 12:56:39 -07:00
Jacob Dufault
e431dbd793
Some renames in indexer. Fix warning for namespace alias.
2017-05-27 12:33:18 -07:00