Commit Graph

187 Commits

Author SHA1 Message Date
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