Commit Graph

308 Commits

Author SHA1 Message Date
Sam McCall 2e50ae6bf2 [Index] fix USR generation for namespace{extern{X}}
llvm-svn: 324093
2018-02-02 14:13:37 +00:00
Argyrios Kyrtzidis 71b74ebb1e [index] Fix crash when indexing a C++14 PCH/module related to TemplateTemplateParmDecls of alias templates
TemplateTemplateParmDecls of alias templates ended-up serialized as 'file-level decls' which was causing a crash while trying to index a PCH/module file that contained them.
Commit makes sure TemplateTemplateParmDecls are not recorded as such kind of decls.

Fixes crash of rdar://36608297

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

llvm-svn: 323549
2018-01-26 19:26:12 +00:00
Sam McCall e83ae11ccc [Index] Reduce size of SymbolInfo struct.
Summary:
This is currently 16 bytes, the patch reduces it to 4.
(Building with clang on linux x84, I guess others are similar)

The only subfield that might need a bigger type is SymbolPropertySet,
I've moved it to the end of the struct so if it grows, SymbolInfo will
only be 8 bytes.

With a full index of namespace-scope symbols from the LLVM project (200k)
loaded into clangd, this saves ~2MB of RAM.

Reviewers: akyrtzi

Subscribers: ilya-biryukov, cfe-commits

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

llvm-svn: 321411
2017-12-23 19:31:24 +00:00
Benjamin Kramer acfa339e15 Refactor overridden methods iteration to avoid double lookups.
Convert most uses to range-for loops. No functionality change intended.

llvm-svn: 320954
2017-12-17 23:52:45 +00:00
Eric Liu 45d14143d7 [Index] Add setPreprocessor member to IndexDataConsumer.
Summary:
This enables us to use information in Preprocessor when handling symbol
occurrences.

Reviewers: arphaman, hokein

Reviewed By: hokein

Subscribers: malaperle, cfe-commits

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

llvm-svn: 320030
2017-12-07 11:04:24 +00:00
Alex Lorenz 41856684c1 [index] tag declarations should use the decl role instead of ref
The 'decl' role is more canonical than the 'ref'. This helps us establish the
'specialization-of' relation just by looking at decls or defs.

rdar://31884960

llvm-svn: 317832
2017-11-09 20:50:59 +00:00
Alex Lorenz 1c628e3c3e [index] __builtin_offset's field reference is located at the end location
The starting location is the location of the '.'

llvm-svn: 317596
2017-11-07 18:25:36 +00:00
Alex Lorenz 7b760095cb [index] index field references in __builtin_offset
rdar://35109556

llvm-svn: 317593
2017-11-07 17:29:11 +00:00
Jan Korous 330f0887d6 Fix indexer crash for default template template parameter value
rdar://33058798

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

llvm-svn: 315367
2017-10-10 21:09:49 +00:00
Jan Korous e6a0242ebc R13575: Fix USR mangling for function pointer types
Differential Revision: https://reviews.llvm.org/D38707

llvm-svn: 315255
2017-10-10 00:35:16 +00:00
Jan Korous 663ba15ed6 PR13575: Fix USR mangling for fixed-size arrays
Differential Revision: https://reviews.llvm.org/D38643

llvm-svn: 315236
2017-10-09 19:51:33 +00:00
Dave Lee 1a532c9e1d [index] Generate class & metaclass manglings for objc
Summary:
ObjC classes have two associated symbols, one for the class and one for the
metaclass.

This change overloads `CodegenNameGenerator::getAllManglings` to produce both
class and metaclass symbols.

While this function is called by `clang_Cursor_getCXXManglings`, it's only
called for CXXRecordDecl and CXXMethodDecl, and so libclang's behavior is
unchanged.

Reviewers: arphaman, abdulras, alexshap, compnerd

Reviewed By: compnerd

Subscribers: compnerd

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

llvm-svn: 313997
2017-09-22 16:58:57 +00:00
Sjoerd Meijer cc623ad071 Recommit "Add _Float16 as a C/C++ source language type"
This is a recommit of r312781; in some build configurations
variable names are omitted, so changed the new regression
test accordingly.

llvm-svn: 312794
2017-09-08 15:15:00 +00:00
Sjoerd Meijer 9aeedde7ff Revert "Add _Float16 as a C/C++ source language type"
The clang-with-lto-ubuntu bot didn't like the new regression
test, revert while I investigate the issue.

llvm-svn: 312784
2017-09-08 10:20:52 +00:00
Sjoerd Meijer ab36f33db8 Add _Float16 as a C/C++ source language type
This adds _Float16 as a source language type, which is a 16-bit floating point
type defined in C11 extension ISO/IEC TS 18661-3.

In follow up patches documentation and more tests will be added.

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

llvm-svn: 312781
2017-09-08 09:42:32 +00:00
Alex Lorenz 36070ed8d2 Print enum constant values using the original source formatting
if possible when creating "Declaration" nodes in XML comments

rdar://14765746

llvm-svn: 311085
2017-08-17 13:41:55 +00:00
Ben Langmuir fd6e39c40b [index] Add indexing for unresolved-using declarations
In dependent contexts we end up referencing these, so make sure they
have USRs, and have their declarations indexed. For the most part they
behave like typedefs, but we also need to worry about having multiple
using declarations with the same "name".

rdar://problem/33883650

llvm-svn: 311053
2017-08-16 23:12:21 +00:00
Argyrios Kyrtzidis 478276271b [index] Update indexing to handle CXXDeductionGuideDecls properly
CXXDeductionGuideDecls can't be referenced so there's no need to output a symbol occurrence for them.
Also handle DeducedTemplateSpecializationTypeLocs in the TypeIndexer so we don't miss the symbol occurrences of the corresponding template decls.

Patch by Nathan Hawes!

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

llvm-svn: 310933
2017-08-15 17:20:37 +00:00
Ben Langmuir 1f3881575a [index] Set SymbolSubKind::Accessor[GS]etter on class methods
We have the same relation between class properties and getter/setters
that we have for instance properties, so set the same symbol sub-kind.

rdar://problem/32376404

llvm-svn: 308800
2017-07-21 23:04:27 +00:00
Krasimir Georgiev e62dd8b5e9 [Index] Prevent canonical decl becoming nullptr
Summary:
This patch prevents getCanonicalDecl returning nullptr in case it finds
a canonical TemplateDeclaration with no attached TemplatedDecl.
Found by running the indexer over a version of the standard library deep inside
a template metaprogramming mess.

Reviewers: klimek, vsk

Reviewed By: vsk

Subscribers: vsk, arphaman, cfe-commits

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

llvm-svn: 308269
2017-07-18 07:20:53 +00:00
Ilya Biryukov 00f5f29535 [index] Added a method indexTopLevelDecls to run indexing on a list of Decls.
Summary:
We need it in clangd for refactoring that replaces ASTUnit
with manual AST management.

Reviewers: akyrtzi, benlangmuir, arphaman, klimek

Reviewed By: arphaman

Subscribers: cfe-commits

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

llvm-svn: 308016
2017-07-14 10:47:45 +00:00
Ben Langmuir da467ed444 [index] Don't add relation to a NamedDecl with no name
Unless it's one of the special cases (tag, category) that we can handle.
This syncs up the check between handling a decl and handling a relation.

This would cause invalid nameless decls to end up in relations despite
having no name or USR.

rdar://problem/32474406

llvm-svn: 307855
2017-07-12 22:05:30 +00:00
Richard Smith 1283e9868d [modules ts] Basic for module linkage.
In addition to the formal linkage rules, the Modules TS includes cases where
internal-linkage symbols within a module interface unit can be referenced from
outside the module via exported inline functions / templates. We give such
declarations "module-internal linkage", which is formally internal linkage, but
results in an externally-visible symbol.

llvm-svn: 307434
2017-07-07 20:04:28 +00:00
Alex Lorenz 200dc12f3b [index] Index nested name qualifiers in a forward declaration of a
class template specialization

rdar://33122110

llvm-svn: 307074
2017-07-04 12:50:53 +00:00
Alex Lorenz be79ca8111 [index] Remove 'implicit' role for message sends in implicit ObjC
property references

rdar://32375673

llvm-svn: 307016
2017-07-03 10:34:46 +00:00
Alex Lorenz b6e03aa967 [index] Add the "SpecializationOf" relation to the forward declarations
of class template specializations

This commit fixes an issue where a forward declaration of a class template
specialization was not related to the base template. We need to relate even
forward declarations because specializations don't have to be defined.

rdar://32869409

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

llvm-svn: 305996
2017-06-22 11:20:07 +00:00
Alex Lorenz d283dd4e06 [index] Nested class declarations should be annotated with the
"specializationOf" relation if they pseudo-override a type in the base template

This commit fixes an issue where Xcode's renaming engine couldn't find the
reference to the second occurrence of "InnerClass" in this example:

template<typename T> struct Ts { template<typename U> struct InnerClass { }; };

template<> struct Ts<int> {
template<typename U> struct InnerClass; // This occurrence wasn't renamed
};

rdar://31884960

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

llvm-svn: 305911
2017-06-21 13:51:04 +00:00
Alex Lorenz 8a656c9597 [index] Record C++17 global binding declarations
The global C++17 binding declarations should be indexed as variable symbols.

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

llvm-svn: 305508
2017-06-15 21:19:01 +00:00
Alex Lorenz 60aac43813 [index] Index static_assert declarations
static_assert declarations have to be visited while indexing so that we can
gather the references to declarations that are present in their assert
expression.

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

llvm-svn: 305504
2017-06-15 20:50:43 +00:00
Alex Lorenz cc8e8494ad [index] The references to explicit class properties should be recorded
rdar://32376363

llvm-svn: 303751
2017-05-24 14:23:40 +00:00
Alex Lorenz 4bbce51539 [index] The references to enum constants from member enums that are
from template instantiations should refer to the enum constant in the pattern
enum in the base template

rdar://32325459

llvm-svn: 303651
2017-05-23 16:47:01 +00:00
Alex Lorenz 9d60520608 [index] The references to member enums from template instantiations should
refer to the pattern member enum in the base template

rdar://32325459

llvm-svn: 303650
2017-05-23 16:35:50 +00:00
Alex Lorenz fcbae3a308 [index] The references to type aliases and typedefs from template
instantiations should refer to the pattern type aliases / typedefs in the base
templates

rdar://32325459

llvm-svn: 303648
2017-05-23 16:27:42 +00:00
Alex Lorenz 73e27a6031 [index] The references to fields from nested records in template instantiations
should refer to the pattern fields in the nested records in the base templates

rdar://32352429

llvm-svn: 303647
2017-05-23 16:25:06 +00:00
Alex Lorenz 2109d436ab [index] The references to records from template instantiations should refer
to the pattern records in the base templates

rdar://32325459

llvm-svn: 303646
2017-05-23 16:23:28 +00:00
Alex Lorenz 80cb549c2f [index] Index the default template parameter values
rdar://32323724

llvm-svn: 303568
2017-05-22 16:50:54 +00:00
Alex Lorenz 832d8fcc63 [index] Index the deleted functions
rdar://32323386

llvm-svn: 303563
2017-05-22 15:42:45 +00:00
Alex Lorenz 365cb47818 [index] Visit the default argument values in function definitions
rdar://32323315

llvm-svn: 303559
2017-05-22 15:17:44 +00:00
Alex Lorenz d65b3e4212 [index] 'using namespace' declarations in functions should record
the reference to the namespace

rdar://32323190

llvm-svn: 303555
2017-05-22 14:39:39 +00:00
Argyrios Kyrtzidis 11d704839f [index] Fix forward declarations interfering with USR generation of external source symbols
Patch by Nathan Hawes.
https://reviews.llvm.org/D33346

llvm-svn: 303484
2017-05-20 04:11:33 +00:00
Alex Lorenz e1e566d4df [index] Record references to class receivers used in property references
rdar://32250025

llvm-svn: 303343
2017-05-18 10:43:11 +00:00
Alex Lorenz 048c8a9e7f [index] References to fields from template instantiations should refer to
fields in base templates

rdar://32197158

llvm-svn: 303068
2017-05-15 14:26:22 +00:00
Alex Lorenz 4ab5193735 [index] Visit and store information about namespace alias declarations
rdar://32195226

llvm-svn: 303048
2017-05-15 10:56:31 +00:00
Alex Lorenz 57c4f648d1 [index] Store correct location for namespace nested name qualifiers
rdar://32195200

llvm-svn: 303046
2017-05-15 10:41:04 +00:00
Alex Lorenz 09653330bc [index] Avoid a crash that happens when looking up a dependent name
in a record that has no definition

rdar://32194921

llvm-svn: 303045
2017-05-15 10:20:39 +00:00
Alex Lorenz d43f75b54a [index] Index template specialization arguments for function templats
Also ensure that class template specialization arguments are covered

rdar://31812032

llvm-svn: 302918
2017-05-12 16:32:26 +00:00
Alex Lorenz 4e1377aff0 [index] Index simple dependent declaration references
This commit implements basic support for indexing of dependent declaration
references. Now the indexer tries to find a suitable match in the base template
for a dependent member ref/decl ref/dependent type.

rdar://29158210

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

llvm-svn: 302632
2017-05-10 09:47:41 +00:00
Alex Lorenz 9e2fea198c [Index] The relation between the declarations in template
specializations that 'override' declarations in the base template should use
the 'specializationOf' relation instead of 'specializationOf | overrideOf'.

The indexer relations are meant to be orthogonal, so 'specializationOf' is
better than the combined relation.

llvm-svn: 302136
2017-05-04 10:42:06 +00:00
Alex Lorenz 45c423bcdc [index] Handle vector types in USR generator
rdar://25339187

llvm-svn: 301635
2017-04-28 09:46:36 +00:00
Argyrios Kyrtzidis e594707dfb [index] Mark the ObjC implicit accessor method definitions as 'dynamic' as well
llvm-svn: 301548
2017-04-27 15:05:18 +00:00