Commit Graph

261 Commits

Author SHA1 Message Date
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
Alex Lorenz f41b21e384 [index] Index type source info for class specializations
rdar://31758344

llvm-svn: 301315
2017-04-25 15:13:42 +00:00
Alex Lorenz 5bf767c548 [index] Record the 'SpecializationOf' relation for function specializations
rdar://31603531

llvm-svn: 301310
2017-04-25 14:22:29 +00:00
Argyrios Kyrtzidis b4b85f2033 [index] If the 'external_source_symbol' attribute indicates 'Swift' as the language then report it accordingly
llvm-svn: 301183
2017-04-24 14:52:00 +00:00
Alex Lorenz a352ba0cbe [index] The relation between the declarations in template specializations
that 'override' declarations in the base template should be recorded

This can be used for improved "go to definition" feature in Xcode.

rdar://31604739

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

llvm-svn: 301180
2017-04-24 14:04:58 +00:00
Argyrios Kyrtzidis f363474996 [index] Take into account the category's external_symbol attr for namespacing its methods
llvm-svn: 301051
2017-04-21 22:27:06 +00:00
Argyrios Kyrtzidis 6e5ca5be53 [index] Take advantage of 'external_source_symbol' attribute for indexing purposes
- Ignore decls marked as 'generated_declaration'
- Include the 'defined_in' in the USR for additional namespacing

llvm-svn: 300949
2017-04-21 05:42:46 +00:00
Argyrios Kyrtzidis f932612fdf [index] For 'transparent' tag typedefs, ignore their tag reference
llvm-svn: 300948
2017-04-21 05:42:40 +00:00
Krasimir Georgiev e48c1b564f Delete unused IncompleteFormat variable, NFCi.
llvm-svn: 300841
2017-04-20 13:37:27 +00:00
Alex Lorenz f6071c34a5 [index] Record class template specializations using a new 'SpecializationOf'
relationship

rdar://31603531

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

llvm-svn: 300832
2017-04-20 10:43:22 +00:00
Simon Pilgrim dfbf049e7f Fix MSVC 'not all control paths return a value' warning.
llvm-svn: 298712
2017-03-24 16:59:14 +00:00
Argyrios Kyrtzidis a9876cafe2 [index] When indexing system headers make sure to report important reference relations
Even if we exclude plain reference occurrences, we should include relation-based references, like the 'base' one.

rdar://31010737

llvm-svn: 298622
2017-03-23 16:34:47 +00:00
Argyrios Kyrtzidis 3b25c91a9e [index/AST] Determine if a typedef shares a name and spelling location with its underlying tag type
In such a case, as when using the NS_ENUM macro, for indexing purposes treat the typedef as 'transparent',
meaning we treat its references as symbols of the underlying tag symbol.
Also provide a libclang API to check for such typedefs.

llvm-svn: 298392
2017-03-21 16:56:02 +00:00
Argyrios Kyrtzidis 573624a9c2 [index] For C++ constructors/destructors, add references to the parent type where its name appears in definitions and declarations
Patch by Nathan Hawes!
https://reviews.llvm.org/D30730

llvm-svn: 298170
2017-03-17 23:41:59 +00:00
Argyrios Kyrtzidis 194b28ebb1 [index/AST] Add references for ObjC getter=/setter= property attributes and related property getter/setter role fixes
This enhances the AST to keep track of locations of the names in those ObjC property attributes, and reports them for indexing.

Patch by Nathan Hawes!
https://reviews.llvm.org/D30907

llvm-svn: 297972
2017-03-16 18:25:40 +00:00
Argyrios Kyrtzidis a9706998f2 [index] Mark categories of test classes with the 'UnitTest' symbol property as well.
llvm-svn: 297133
2017-03-07 09:38:08 +00:00
Argyrios Kyrtzidis 898c241b26 [index] C++: Improve handling of typedefs as base names in C++ class declarations
Report the typedef as reference, and desugar it to report the underlying class as an
implicit 'base' reference.
Reporting the underlying base class for 'base' relations matches the ObjC handling and
leads to a simpler model.

llvm-svn: 296975
2017-03-04 17:54:56 +00:00
Argyrios Kyrtzidis 266cfa30dc [index] ObjC: Improve handling of typedefs as base names in ObjC interface declarations
- Report the typedef reference occurrence
- Mark super or protocol references as 'implicit' when they come from a typedef.

llvm-svn: 296974
2017-03-04 17:54:53 +00:00
Krasimir Georgiev 32eaa864e3 [clang-format] Add a new flag FixNamespaceComments to FormatStyle
Summary:
This patch enables namespace end comments under a new flag FixNamespaceComments,
which is enabled for the LLVM and Google styles.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 296632
2017-03-01 15:35:39 +00:00
Argyrios Kyrtzidis 6d1a15b2d4 [index] Add 'Parameter' symbol kind and 'Local' symbol property to distinguish function-local symbols
Parameters have a 'child' relation to their function/method.
Also add an option '-include-locals' to 'c-index-test core' to enable indexing of function-local symbols.

Original patch from Nathan Hawes with some changes by me.
https://reviews.llvm.org/D30304

llvm-svn: 296282
2017-02-26 05:37:56 +00:00
Argyrios Kyrtzidis 74790484b5 [index] Improvde how we handle synthesized ObjC properties and the associated ivars.
Related synthesized properties with the ivar they use with the 'accessor' relation, and make sure
we mark them 'implicit' when appropriate.

Patch by Nathan Hawes!
https://reviews.llvm.org/D30012

llvm-svn: 295416
2017-02-17 04:49:41 +00:00
Anastasia Stulova 58984e7087 [OpenCL] Correct ndrange_t implementation
Removed ndrange_t as Clang builtin type and added
as a struct type in the OpenCL header.

Use type name to do the Sema checking in enqueue_kernel
and modify IR generation accordingly.

Review: D28058

Patch by Dmitry Borisenkov!  
 

llvm-svn: 295311
2017-02-16 12:27:47 +00:00
Argyrios Kyrtzidis 7d90ed0ac9 [index] USR generation: use getTemplateArgs() instead of getTemplateInstantiationArgs()
Otherwise we may end up creating a different USR for the definition of a function, vs its declaration.

llvm-svn: 295191
2017-02-15 16:16:27 +00:00
Argyrios Kyrtzidis 5b7a09aca4 [index] Provide a more general index::generateUSRForMacro() that doesn't depend on having a PreprocessingRecord.
llvm-svn: 293904
2017-02-02 16:13:10 +00:00
Argyrios Kyrtzidis b065ecf4f0 [index] CMake: add missing reference to clangSerialization library.
llvm-svn: 293463
2017-01-30 06:48:27 +00:00
Argyrios Kyrtzidis a38cb204a3 [c-index-test] Provide capability to index module file imports and dump their input files.
This ensures the capability to index a module file using an existing ASTReader from a compiler instance or ASTUnit.

llvm-svn: 293461
2017-01-30 06:05:58 +00:00
Argyrios Kyrtzidis aee15fb204 [index] When indexing an ObjC method declaration use its base name for the location.
Instead of using the location of the beginning '-'/'+'.
This is consistent with location used for function decls and ObjC method calls where we use the base name as the location as well.

llvm-svn: 293134
2017-01-26 02:11:50 +00:00
Argyrios Kyrtzidis 2a89c8594d [index] Introduce symbol subkinds to mark an accessor getter or setter.
llvm-svn: 291707
2017-01-11 21:42:48 +00:00
Argyrios Kyrtzidis 38004319fa [index] Ignore invalid ObjC categories.
We currently are unable to get a USR for those and it doesn't seem useful to try to index them.

llvm-svn: 291705
2017-01-11 21:08:31 +00:00
Argyrios Kyrtzidis de0f50886f [index] Add 'IBTypeOf' relation for ObjC methods marked with IBAction and properties with IBOutletCollection.
llvm-svn: 291703
2017-01-11 21:01:07 +00:00
Argyrios Kyrtzidis df60aa83a3 [index] Add 'contained-by' relation between references and their lexical container.
llvm-svn: 291700
2017-01-11 20:51:10 +00:00
Argyrios Kyrtzidis e24f5e204b [index] Introduce SymbolSubKind for reporting language-specific details.
Initially reports if a constructor symbol is a copy or move constructor.

llvm-svn: 291409
2017-01-08 23:21:35 +00:00
Argyrios Kyrtzidis db4698352e [index] Rename SymbolSubKind -> SymbolProperty, NFC.
This better reflects what it represents.

llvm-svn: 286680
2016-11-11 23:49:55 +00:00
Argyrios Kyrtzidis f42032abde [index] Add SymbolSubKind for the GKInspectable annotation.
llvm-svn: 286518
2016-11-10 23:27:11 +00:00
Daniel Jasper d21485d2f5 Remove FormatContext from libClang as it is now unused.
llvm-svn: 286279
2016-11-08 19:47:19 +00:00
Daniel Jasper 1619805099 Revert "Remove now unnecessary FormatRewriterContext."
This reverts commit r286262. I accidentally committed it without all of
the changes.

llvm-svn: 286264
2016-11-08 18:30:52 +00:00
Daniel Jasper e527dc6223 Remove now unnecessary FormatRewriterContext.
llvm-svn: 286262
2016-11-08 18:29:19 +00:00
Daniel Jasper 528d682ff6 [clang-format] Remove (SourceManager, FileID) variants
In Format, remove the reformat() and clean() functions taking a SourceManager
and a FileID. Keep the versions taking StringRef Code.

- there was duplicated functionality
- the FileID versions were harder to use
- the clean() version is dead code anyways

Patch by Krasimir Georgiev. Thank you.

llvm-svn: 286243
2016-11-08 16:11:33 +00:00
Argyrios Kyrtzidis 9d8ab72a69 [index] Handle properly C++14's template variables.
- Infer the right symbol kind.
- Provide a templated USR, similar to how we handle class templates.

rdar://28980398

llvm-svn: 286154
2016-11-07 21:20:15 +00:00
Argyrios Kyrtzidis 3e5b61f7da [index] Make sure to mark class template symbols as having 'generic' sub-kind.
llvm-svn: 286153
2016-11-07 21:20:08 +00:00
Argyrios Kyrtzidis f12918d218 [index] Fix assertion hit when handling a declaration of C++'s 'operator new' function.
Part of this is to allow creating a USR for the canonical decl of that which is implicit and does
not have a source location.

rdar://28978992

llvm-svn: 285868
2016-11-02 23:42:33 +00:00
Argyrios Kyrtzidis 4db30af1f8 [index] Avoid using a RecursiveASTVisitor for SyntacticFormIndexer and iterate the DesignatedInitExprs of the InitListExpr directly.
This is more efficient, as per feedback by Richard.

llvm-svn: 285666
2016-11-01 04:29:39 +00:00
Argyrios Kyrtzidis 67eda2ad1d [index] Fix repeated visitation of the same InitListExpr for indexing.
It was visited multiple times unnecessarily.

rdar://28985038

llvm-svn: 285647
2016-10-31 22:12:12 +00:00
Argyrios Kyrtzidis 806faaf42b [index] Fixes for locations and relations in Objective C categories and getters/setters
- Add entries for protocols on categories
- Add relation between categories and class they extend
- Add relation between getters/setters and their corresponding property
- Use category name location as the location of category decls/defs if it has one

llvm-svn: 285120
2016-10-25 21:11:22 +00:00
Martin Bohme d5f94a6a59 Visit lambda capture inits from RecursiveASTVisitor::TraverseLambdaCapture().
Summary:
rL277342 made RecursiveASTVisitor visit lambda capture initialization
expressions (these are the Exprs in LambdaExpr::capture_inits()).

jdennett identified two issues with rL277342 (see comments there for details):

- It visits initialization expressions for implicit lambda captures, even if
  shouldVisitImplicitCode() returns false.

- It visits initialization expressions for init captures twice (because these
  were already traveresed in TraverseLambdaCapture() before rL277342)

This patch fixes these issues and moves the code for traversing initialization
expressions into TraverseLambdaCapture().

This patch also makes two changes required for the tests:

- It adds Lang_CXX14 to the Language enum in TestVisitor.

- It adds a parameter to ExpectedLocationVisitor::ExpectMatch() that specifies
  the number of times a match is expected to be seen.

Reviewers: klimek, jdennett, alexfh

Subscribers: cfe-commits

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

llvm-svn: 278933
2016-08-17 14:59:53 +00:00
Argyrios Kyrtzidis f60c395e84 [index] Fix crash with indexing designated init expressions inside templates.
rdar://27452869

llvm-svn: 277570
2016-08-03 05:38:53 +00:00
Mehdi Amini 9670f847b8 [NFC] Header cleanup
Summary: Removed unused headers, replaced some headers with forward class declarations

Patch by: Eugene <claprix@yandex.ru>

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

llvm-svn: 275882
2016-07-18 19:02:11 +00:00
Argyrios Kyrtzidis d9849a972b [index] Create different USR if a property is a class property.
Avoids USR conflicts between class & instance properties of the same name.

llvm-svn: 275630
2016-07-15 22:18:19 +00:00