Commit Graph

261 Commits

Author SHA1 Message Date
Alex Lorenz c77ddfcae5 [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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302136 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 10:42:06 +00:00
Alex Lorenz c4d3e60b62 [index] Handle vector types in USR generator
rdar://25339187


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301635 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 09:46:36 +00:00
Argyrios Kyrtzidis bf5a77287b [index] Mark the ObjC implicit accessor method definitions as 'dynamic' as well
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301548 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 15:05:18 +00:00
Alex Lorenz 9a24d62d45 [index] Index type source info for class specializations
rdar://31758344


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301315 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 15:13:42 +00:00
Alex Lorenz bc371f9ed3 [index] Record the 'SpecializationOf' relation for function specializations
rdar://31603531


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301310 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 14:22:29 +00:00
Argyrios Kyrtzidis 8f2ae42562 [index] If the 'external_source_symbol' attribute indicates 'Swift' as the language then report it accordingly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301183 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 14:52:00 +00:00
Alex Lorenz 6d3ec86383 [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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301180 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 14:04:58 +00:00
Argyrios Kyrtzidis 54fef63e22 [index] Take into account the category's external_symbol attr for namespacing its methods
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301051 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:27:06 +00:00
Argyrios Kyrtzidis efab042a8b [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300949 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 05:42:46 +00:00
Argyrios Kyrtzidis 4802bbed82 [index] For 'transparent' tag typedefs, ignore their tag reference
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300948 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 05:42:40 +00:00
Krasimir Georgiev 3e6188d584 Delete unused IncompleteFormat variable, NFCi.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300841 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 13:37:27 +00:00
Alex Lorenz 59a0c5ecb8 [index] Record class template specializations using a new 'SpecializationOf'
relationship

rdar://31603531

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300832 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 10:43:22 +00:00
Simon Pilgrim 91167dbab2 Fix MSVC 'not all control paths return a value' warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298712 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24 16:59:14 +00:00
Argyrios Kyrtzidis 53160ec419 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298622 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 16:34:47 +00:00
Argyrios Kyrtzidis 8cf917cee9 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298392 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 16:56:02 +00:00
Argyrios Kyrtzidis 2040f8c570 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298170 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 23:41:59 +00:00
Argyrios Kyrtzidis 10eccfa5a0 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297972 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-16 18:25:40 +00:00
Argyrios Kyrtzidis 0bfb9a5b9a [index] Mark categories of test classes with the 'UnitTest' symbol property as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297133 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-07 09:38:08 +00:00
Argyrios Kyrtzidis e54da63eff [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296975 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-04 17:54:56 +00:00
Argyrios Kyrtzidis ea71a9a14a [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296974 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-04 17:54:53 +00:00
Krasimir Georgiev 54958796cc [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296632 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-01 15:35:39 +00:00
Argyrios Kyrtzidis 1d680d2459 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296282 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-26 05:37:56 +00:00
Argyrios Kyrtzidis 10d3537953 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295416 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-17 04:49:41 +00:00
Anastasia Stulova f5802a7c28 [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!  
 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295311 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-16 12:27:47 +00:00
Argyrios Kyrtzidis c64d3a5d1a [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295191 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-15 16:16:27 +00:00
Argyrios Kyrtzidis 21c8bcd7af [index] Provide a more general index::generateUSRForMacro() that doesn't depend on having a PreprocessingRecord.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293904 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 16:13:10 +00:00
Argyrios Kyrtzidis 283758207c [index] CMake: add missing reference to clangSerialization library.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293463 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 06:48:27 +00:00
Argyrios Kyrtzidis 5625df6660 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293461 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 06:05:58 +00:00
Argyrios Kyrtzidis 9a249fca06 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293134 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-26 02:11:50 +00:00
Argyrios Kyrtzidis 4a19ab5950 [index] Introduce symbol subkinds to mark an accessor getter or setter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291707 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-11 21:42:48 +00:00
Argyrios Kyrtzidis 4cb22979c5 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291705 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-11 21:08:31 +00:00
Argyrios Kyrtzidis 8293248be4 [index] Add 'IBTypeOf' relation for ObjC methods marked with IBAction and properties with IBOutletCollection.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291703 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-11 21:01:07 +00:00
Argyrios Kyrtzidis 231cda663b [index] Add 'contained-by' relation between references and their lexical container.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291700 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-11 20:51:10 +00:00
Argyrios Kyrtzidis c900a4b13d [index] Introduce SymbolSubKind for reporting language-specific details.
Initially reports if a constructor symbol is a copy or move constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291409 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-08 23:21:35 +00:00
Argyrios Kyrtzidis 0e0e98c015 [index] Rename SymbolSubKind -> SymbolProperty, NFC.
This better reflects what it represents.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286680 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 23:49:55 +00:00
Argyrios Kyrtzidis b5e3c67b85 [index] Add SymbolSubKind for the GKInspectable annotation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286518 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-10 23:27:11 +00:00
Daniel Jasper b74377b0a3 Remove FormatContext from libClang as it is now unused.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286279 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-08 19:47:19 +00:00
Daniel Jasper 4aa6d8f2e2 Revert "Remove now unnecessary FormatRewriterContext."
This reverts commit r286262. I accidentally committed it without all of
the changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286264 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-08 18:30:52 +00:00
Daniel Jasper 433b17d958 Remove now unnecessary FormatRewriterContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286262 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-08 18:29:19 +00:00
Daniel Jasper 3c0f4eaf96 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286243 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-08 16:11:33 +00:00
Argyrios Kyrtzidis 0e2326e6f9 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286154 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-07 21:20:15 +00:00
Argyrios Kyrtzidis cf55f2614a [index] Make sure to mark class template symbols as having 'generic' sub-kind.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286153 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-07 21:20:08 +00:00
Argyrios Kyrtzidis eab101ef5f [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285868 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-02 23:42:33 +00:00
Argyrios Kyrtzidis ba894e9784 [index] Avoid using a RecursiveASTVisitor for SyntacticFormIndexer and iterate the DesignatedInitExprs of the InitListExpr directly.
This is more efficient, as per feedback by Richard.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285666 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-01 04:29:39 +00:00
Argyrios Kyrtzidis e30072cab9 [index] Fix repeated visitation of the same InitListExpr for indexing.
It was visited multiple times unnecessarily.

rdar://28985038

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285647 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-31 22:12:12 +00:00
Argyrios Kyrtzidis 5692230ed4 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285120 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 21:11:22 +00:00
Martin Bohme 70e216b530 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278933 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 14:59:53 +00:00
Argyrios Kyrtzidis 9f9a4eb120 [index] Fix crash with indexing designated init expressions inside templates.
rdar://27452869

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277570 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 05:38:53 +00:00
Mehdi Amini 2e23251d3e [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275882 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 19:02:11 +00:00
Argyrios Kyrtzidis 51856a5426 [index] Create different USR if a property is a class property.
Avoids USR conflicts between class & instance properties of the same name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275630 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 22:18:19 +00:00