Commit Graph

389 Commits

Author SHA1 Message Date
Mikael Nilsson 78de84719b [OpenCL] Add generic AS to 'this' pointer
Address spaces are cast into generic before invoking the constructor.

Added support for a trailing Qualifiers object in FunctionProtoType.

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

llvm-svn: 348927
2018-12-12 14:11:59 +00:00
Ilya Biryukov a622484fa6 [Index] Expose USR generation for types
Summary: Used in clangd.

Reviewers: sammccall, ioeric

Reviewed By: sammccall

Subscribers: kadircet, cfe-commits

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

llvm-svn: 347558
2018-11-26 15:24:48 +00:00
Andrew Savonichev 3fee351867 [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
Summary:
Documentation can be found at https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_device_side_avc_motion_estimation.txt

Patch by Kristina Bessonova


Reviewers: Anastasia, yaxunl, shafik

Reviewed By: Anastasia

Subscribers: arphaman, sidorovd, AlexeySotkin, krisb, bader, asavonic, cfe-commits

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

llvm-svn: 346392
2018-11-08 11:25:41 +00:00
Andrew Savonichev 3b12b7e702 Revert r346326 [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation
This patch breaks Index/opencl-types.cl LIT test:

Script:
--
: 'RUN: at line 1';   stage1/bin/c-index-test -test-print-type llvm/tools/clang/test/Index/opencl-types.cl -cl-std=CL2.0 | stage1/bin/FileCheck llvm/tools/clang/test/Index/opencl-types.cl
--
Command Output (stderr):
--
llvm/tools/clang/test/Index/opencl-types.cl:3:26: warning: unsupported OpenCL extension 'cl_khr_fp16' - ignoring [-Wignored-pragmas]
llvm/tools/clang/test/Index/opencl-types.cl:4:26: warning: unsupported OpenCL extension 'cl_khr_fp64' - ignoring [-Wignored-pragmas]
llvm/tools/clang/test/Index/opencl-types.cl:8:9: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:11:8: error: declaring variable of type 'half' is not allowed
llvm/tools/clang/test/Index/opencl-types.cl:15:3: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:16:3: error: use of type 'double4' (vector of 4 'double' values) requires cl_khr_fp64 extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:26:26: warning: unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring [-Wignored-pragmas]
llvm/tools/clang/test/Index/opencl-types.cl:35:44: error: use of type '__read_only image2d_msaa_t' requires cl_khr_gl_msaa_sharing extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:36:49: error: use of type '__read_only image2d_array_msaa_t' requires cl_khr_gl_msaa_sharing extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:37:49: error: use of type '__read_only image2d_msaa_depth_t' requires cl_khr_gl_msaa_sharing extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:38:54: error: use of type '__read_only image2d_array_msaa_depth_t' requires cl_khr_gl_msaa_sharing extension to be enabled

llvm-svn: 346338
2018-11-07 18:34:19 +00:00
Andrew Savonichev 35dfce723c [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
Summary:
Documentation can be found at https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_device_side_avc_motion_estimation.txt

Patch by Kristina Bessonova


Reviewers: Anastasia, yaxunl, shafik

Reviewed By: Anastasia

Subscribers: arphaman, sidorovd, AlexeySotkin, krisb, bader, asavonic, cfe-commits

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

llvm-svn: 346326
2018-11-07 15:44:01 +00:00
Reid Kleckner 4dc0b1ac60 Fix clang -Wimplicit-fallthrough warnings across llvm, NFC
This patch should not introduce any behavior changes. It consists of
mostly one of two changes:
1. Replacing fall through comments with the LLVM_FALLTHROUGH macro
2. Inserting 'break' before falling through into a case block consisting
   of only 'break'.

We were already using this warning with GCC, but its warning behaves
slightly differently. In this patch, the following differences are
relevant:
1. GCC recognizes comments that say "fall through" as annotations, clang
   doesn't
2. GCC doesn't warn on "case N: foo(); default: break;", clang does
3. GCC doesn't warn when the case contains a switch, but falls through
   the outer case.

I will enable the warning separately in a follow-up patch so that it can
be cleanly reverted if necessary.

Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu

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

llvm-svn: 345882
2018-11-01 19:54:45 +00:00
Jonas Devlieghere fc51490baf Lift VFS from clang to llvm (NFC)
This patch moves the virtual file system form clang to llvm so it can be
used by more projects.

Concretely the patch:
 - Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support.
 - Moves the corresponding unit test from clang to llvm.
 - Moves the vfs namespace from clang::vfs to llvm::vfs.
 - Formats the lines affected by this change, mostly this is the result of
   the added llvm namespace.

RFC on the mailing list:
http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html

Differential revision: https://reviews.llvm.org/D52783

llvm-svn: 344140
2018-10-10 13:27:25 +00:00
Fangrui Song 63a8b6c304 [Index] Use locations to uniquify function-scope BindingDecl USR
Summary:
This makes BindingDecl's of the same name have different USRs, so that references can be correctly attributed.

    int a[1] = {};
    { auto [x] = a; x; }
    { auto [x] = a; x; }

Reviewers: akyrtzi, arphaman, rsmith, hokein

Reviewed By: hokein

Subscribers: cfe-commits

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

llvm-svn: 344010
2018-10-09 01:02:56 +00:00
Haojian Wu e94c869434 [Index] Respect "IndexFunctionLocals" option for type loc.
Summary:
Previously, clang index ignored local symbols defined in the function body even
IndexFunctionLocals is true.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, ioeric, arphaman, kadircet, cfe-commits

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

llvm-svn: 343767
2018-10-04 11:03:55 +00:00
Fangrui Song f750f7f3fb [Index] Report specialization bases as references when IndexImplicitInstantiation is true
Summary:
    template <typename T> struct B {};
    template <typename T> struct D : B<T> {}; // `B` was not reported as a reference

This patch fixes this.

Reviewers: akyrtzi, arphaman, devnexen

Reviewed By: devnexen

Subscribers: cfe-commits

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

llvm-svn: 342831
2018-09-23 08:23:48 +00:00
Argyrios Kyrtzidis 32e5d8626d [index] Enhance indexing for module references
* Create a USR for the occurrences of the 'module' symbol kind
* Record module references for each identifier in an import declaration

llvm-svn: 342484
2018-09-18 15:02:56 +00:00
Eric Liu 4d22172b3a [Index] Add an option to collect macros from preprocesor.
Summary: Also added unit tests for the index library; lit+c-index-test is painful...

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: mgorny, cfe-commits

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

llvm-svn: 342451
2018-09-18 08:51:08 +00:00
Argyrios Kyrtzidis 7c3a12ff42 [index] Introduce 'ProtocolInterface' as part of SymbolPropertySet
This is useful to directly infer that a method or property is from a protocol interface
at the point of the symbol occurrences.

llvm-svn: 340696
2018-08-26 06:27:23 +00:00
Argyrios Kyrtzidis c0cd01764f [index] For an ObjC message call, also record as receivers the protocols if they are present in the ObjC type
llvm-svn: 340109
2018-08-17 23:50:59 +00:00
Stephen Kelly 1c301dcbc4 Port getLocEnd -> getEndLoc
Reviewers: teemperor!

Subscribers: cfe-commits

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

llvm-svn: 339386
2018-08-09 21:09:38 +00:00
Stephen Kelly f2ceec4811 Port getLocStart -> getBeginLoc
Reviewers: teemperor!

Subscribers: jholewinski, whisperity, jfb, cfe-commits

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

llvm-svn: 339385
2018-08-09 21:08:08 +00:00
Fangrui Song 6907ce2f8f Remove trailing space
sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h}

llvm-svn: 338291
2018-07-30 19:24:48 +00:00
Eric Liu 3e0051bb51 [Index] Set OrigD before D is changed.
Reviewers: akyrtzi, arphaman

Reviewed By: akyrtzi

Subscribers: cfe-commits

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

llvm-svn: 337529
2018-07-20 08:08:56 +00:00
Fangrui Song d50f36ed77 [Index] Add index::IndexingOptions::IndexImplicitInstantiation
Summary:
With IndexImplicitInstantiation=true, the following case records an occurrence of B::bar in A::foo, which will benefit cross reference tools.

template <class T> struct B { void bar() {}};
template <class T> struct A { void foo(B<T> *x) { x->bar(); }};
int main() { A<int> a; a.foo(0); }

Reviewers: akyrtzi, arphaman, rsmith

Subscribers: cfe-commits

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

llvm-svn: 336606
2018-07-09 21:49:06 +00:00
Eric Liu 22a0c8dbc8 [Index] Ignore noop #undef's when handling macro occurrences.
llvm-svn: 336584
2018-07-09 19:02:41 +00:00
Heejin Ahn 555cbebdf2 [Index] Add clangLex to LINK_LIBS
Without this, builds with `-DSHARED_LIB=ON` fail.

llvm-svn: 336526
2018-07-09 08:54:42 +00:00
Eric Liu 8c97195cc8 [Index] Add indexing support for MACROs.
Reviewers: akyrtzi, arphaman, sammccall

Reviewed By: sammccall

Subscribers: malaperle, sammccall, cfe-commits

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

llvm-svn: 336524
2018-07-09 08:44:05 +00:00
Fangrui Song b1e31e59d4 [Index] Remove unused index::IndexDataConsumer::_anchor()
It was supposed to serve as a key function, but it was invalid as it was not the first out-of-line non-pure virtual function.

llvm-svn: 336300
2018-07-05 00:33:03 +00:00
Leonard Chan ab80f3c8b7 [Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents
This diff includes changes for the remaining _Fract and _Sat fixed point types.

```
signed short _Fract s_short_fract;
signed _Fract s_fract;
signed long _Fract s_long_fract;
unsigned short _Fract u_short_fract;
unsigned _Fract u_fract;
unsigned long _Fract u_long_fract;

// Aliased fixed point types
short _Accum short_accum;
_Accum accum;
long _Accum long_accum;
short _Fract short_fract;
_Fract fract;
long _Fract long_fract;

// Saturated fixed point types
_Sat signed short _Accum sat_s_short_accum;
_Sat signed _Accum sat_s_accum;
_Sat signed long _Accum sat_s_long_accum;
_Sat unsigned short _Accum sat_u_short_accum;
_Sat unsigned _Accum sat_u_accum;
_Sat unsigned long _Accum sat_u_long_accum;
_Sat signed short _Fract sat_s_short_fract;
_Sat signed _Fract sat_s_fract;
_Sat signed long _Fract sat_s_long_fract;
_Sat unsigned short _Fract sat_u_short_fract;
_Sat unsigned _Fract sat_u_fract;
_Sat unsigned long _Fract sat_u_long_fract;

// Aliased saturated fixed point types
_Sat short _Accum sat_short_accum;
_Sat _Accum sat_accum;
_Sat long _Accum sat_long_accum;
_Sat short _Fract sat_short_fract;
_Sat _Fract sat_fract;
_Sat long _Fract sat_long_fract;
```

This diff only allows for declaration of these fixed point types. Assignment and other operations done on fixed point types according to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf will be added in future patches.

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

llvm-svn: 334718
2018-06-14 14:53:51 +00:00
Leonard Chan f921d85422 This diff includes changes for supporting the following types.
// Primary fixed point types
signed short _Accum s_short_accum;
signed _Accum s_accum;
signed long _Accum s_long_accum;
unsigned short _Accum u_short_accum;
unsigned _Accum u_accum;
unsigned long _Accum u_long_accum;

// Aliased fixed point types
short _Accum short_accum;
_Accum accum;
long _Accum long_accum;
This diff only allows for declaration of the fixed point types. Assignment and other operations done on fixed point types according to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf will be added in future patches. The saturated versions of these types and the equivalent _Fract types will also be added in future patches.

The tests included are for asserting that we can declare these types.

Fixed the test that was failing by not checking for dso_local on some
targets.

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

llvm-svn: 333923
2018-06-04 16:07:52 +00:00
Leonard Chan 0d485dbb40 Revert "This diff includes changes for supporting the following types."
This reverts commit r333814, which fails for a test checking the bit
width on ubuntu.

llvm-svn: 333815
2018-06-02 03:27:13 +00:00
Leonard Chan db55d8331e This diff includes changes for supporting the following types.
```

// Primary fixed point types
signed short _Accum s_short_accum;
signed _Accum s_accum;
signed long _Accum s_long_accum;
unsigned short _Accum u_short_accum;
unsigned _Accum u_accum;
unsigned long _Accum u_long_accum;

// Aliased fixed point types
short _Accum short_accum;
_Accum accum;
long _Accum long_accum;

```

This diff only allows for declaration of the fixed point types. Assignment and other operations done on fixed point types according to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf will be added in future patches. The saturated versions of these types and the equivalent `_Fract` types will also be added in future patches.

The tests included are for asserting that we can declare these types.

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

llvm-svn: 333814
2018-06-02 02:58:51 +00:00
Adrian Prantl 9fc8faf9e6 Remove \brief commands from doxygen comments.
This is similar to the LLVM change https://reviews.llvm.org/D46290.

We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

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

llvm-svn: 331834
2018-05-09 01:00:01 +00:00
Richard Smith 3a8244df6f Implement P0482R2, support for char8_t type.
This is not yet part of any C++ working draft, and so is controlled by the flag
-fchar8_t rather than a -std= flag. (The GCC implementation is controlled by a
flag with the same name.)

This implementation is experimental, and will be removed or revised
substantially to match the proposal as it makes its way through the C++
committee.

llvm-svn: 331244
2018-05-01 05:02:45 +00:00
Benjamin Kramer 6f33fca7ec [index] Fix methods that take a shared_ptr to just take a reference.
There is no ownership here, passing a shared_ptr just adds confusion. No
functionality change intended.

llvm-svn: 330595
2018-04-23 14:30:21 +00:00
Sam McCall cc026ebf32 [Index] Return SourceLocation to consumers, not FileID/Offset pair.
Summary:
The FileID/Offset conversion is lossy. The code takes the fileLoc, which loses
e.g. the spelling location in some macro cases.
Instead, pass the original SourceLocation which preserves all information, and
update consumers to match current behavior.

This allows us to fix two bugs in clangd that need the spelling location.

Reviewers: akyrtzi, arphaman

Subscribers: ilya-biryukov, ioeric, cfe-commits

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

llvm-svn: 329570
2018-04-09 14:12:51 +00:00
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
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