Commit Graph

1115 Commits

Author SHA1 Message Date
Alex Denisov fde64956f9 [ObjC] Add NSValue support for objc_boxed_expressions
Patch extends ObjCBoxedExpr to accept records (structs and unions):

typedef struct __attribute__((objc_boxable)) _Color {
  int r, g, b;
} Color;

Color color;
NSValue *boxedColor = @(color); // [NSValue valueWithBytes:&color objCType:@encode(Color)];

llvm-svn: 240761
2015-06-26 05:28:36 +00:00
Douglas Gregor aea7afdc13 Replace __double_underscored type nullability qualifiers with _Uppercase_underscored
Addresses a conflict with glibc's __nonnull macro by renaming the type
nullability qualifiers as follows:

  __nonnull -> _Nonnull
  __nullable -> _Nullable
  __null_unspecified -> _Null_unspecified

This is the major part of rdar://problem/21530726, but does not yet
provide the Darwin-specific behavior for the old names.

llvm-svn: 240596
2015-06-24 22:02:08 +00:00
Douglas Gregor 86b4268153 Code completion for nullability type specifiers.
Another part of rdar://problem/18868820.

llvm-svn: 240159
2015-06-19 18:27:52 +00:00
Douglas Gregor 813a066f16 Extend type nullability qualifiers for Objective-C.
Introduce context-sensitive, non-underscored nullability specifiers
(nonnull, nullable, null_unspecified) for Objective-C method return
types, method parameter types, and properties.

Introduce Objective-C-specific semantics, including computation of the
nullability of the result of a message send, merging of nullability
information from the @interface of a class into its @implementation,
etc .

This is the Objective-C part of rdar://problem/18868820.

llvm-svn: 240154
2015-06-19 18:14:38 +00:00
Richard Smith 3d8fceafe6 Commit some test changes somehow missed in r239789.
llvm-svn: 239791
2015-06-16 00:19:29 +00:00
Richard Smith bca31b731b [modules] Move implicit creation of ImportDecls for #includes transformed into module imports from the frontend into Sema where it belongs.
llvm-svn: 237555
2015-05-18 05:35:52 +00:00
Richard Smith 63b6fcef96 [modules] Refactor and simplify #include handling.
Fix a tiny bug where we'd try to load a module file for the module we're in
the middle of building.

llvm-svn: 237552
2015-05-18 04:45:41 +00:00
Richard Smith 20e883e59b [modules] Stop trying to fake up a linear MacroDirective history.
Modules builds fundamentally have a non-linear macro history. In the interest
of better source fidelity, represent the macro definition information
faithfully: we have a linear macro directive history within each module, and at
any point we have a unique "latest" local macro directive and a collection of
visible imported directives. This also removes the attendent complexity of
attempting to create a correct MacroDirective history (which we got wrong
in the general case).

No functionality change intended.

llvm-svn: 236176
2015-04-29 23:20:19 +00:00
Argyrios Kyrtzidis 2bff5161c4 [libclang] Add functions to get information about fields.
Patch by Loïc Jaquemet!

llvm-svn: 234762
2015-04-13 16:55:04 +00:00
Argyrios Kyrtzidis ee1d76f361 [libclang] Fix crash when code-completing inside constructor initializer for a builtin type.
rdar://20149746

llvm-svn: 232145
2015-03-13 07:39:30 +00:00
Argyrios Kyrtzidis 58d0e7ab79 [libclang] During member ref expression visitation, ignore base anonymous struct/union fields.
Otherwise they will shadow the real field that that we are interested in.

rdar://19783938

llvm-svn: 232141
2015-03-13 04:40:07 +00:00
Argyrios Kyrtzidis f0b4cd1ed3 [ASTUnit] Fix crash when trying to load a module file via ASTUnit::LoadFromASTFile.
rdar://19997358

llvm-svn: 231060
2015-03-03 08:04:19 +00:00
Filipe Cabecinhas a076430ba9 Add -frtti/-fexceptions to some more tests that assume they're on
llvm-svn: 230656
2015-02-26 18:29:41 +00:00
Adrian Prantl cbc368c5b5 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
llvm-svn: 230454
2015-02-25 02:44:04 +00:00
Adrian Prantl 8bf7af3de8 Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

This reapplies r230044 with a fixed configure+make build and updated
dependencies and testcase requirements. Over the last iteration this
version adds
- missing target requirements for testcases that specify an x86 triple,
- a missing clangCodeGen.a dependency to libClang.a in the make build.

rdar://problem/19104245

llvm-svn: 230423
2015-02-25 01:31:45 +00:00
Rafael Espindola 3c5f2354b8 This reverts commit r227432, r227438 and r227448.
It should bring the bots back.

Original messagses:

r227448:
   Remove unnecessary default.

r227438:
   Fix Index/print-type.cpp test following r227432.

r227432:
    libclang: Add three functions useful for dealing with anonymous fields:
       clang_Cursor_getOffsetOfField
       clang_Cursor_isAnonymous
       clang_Type_visitFields
    Python: Add corresponding methods for dealing with anonymous fields.

    Patch by Loïc Jaquemet

llvm-svn: 227472
2015-01-29 17:22:53 +00:00
Francois Pichet b4c7a47cd8 Fix Index/print-type.cpp test following r227432.
llvm-svn: 227438
2015-01-29 13:33:44 +00:00
Francois Pichet f3be1cc5a9 libclang: Add three functions useful for dealing with anonymous fields:
clang_Cursor_getOffsetOfField
   clang_Cursor_isAnonymous
   clang_Type_visitFields
Python: Add corresponding methods for dealing with anonymous fields.

Patch by Loïc Jaquemet

llvm-svn: 227432
2015-01-29 12:45:29 +00:00
Francisco Lopes da Silva 0c010cddb3 Improves overload completion result chunks.
The code building the code completion string for overloads was providing
less detail compared to the one building completion strings for function
declarations. There was no information about optionals and no information
about what's a parameter and what's a function identifier, everything
besides ResultType, CurrentParameter and special characters was classified
as Text.

This makes code completion strings for overload candidates to follow a
pattern very similar, but not identical, to the one in use for function
declarations:

 - return type chunk: ResultType
 - function identifier chunk: Text
 - parameter chunks: Placeholder
 - optional parameter chunks: Optional
 - current parameter chunk: CurrentParameter

llvm-svn: 227309
2015-01-28 14:17:22 +00:00
Francisco Lopes da Silva a349a8aee9 Sema: require a complete type before lookup.
llvm-svn: 227037
2015-01-25 08:47:59 +00:00
Francisco Lopes da Silva 13937abe88 Add tests for code completion of variadic prototypes
llvm-svn: 226924
2015-01-23 19:06:57 +00:00
Francisco Lopes da Silva c6ccc4fe91 Sema: code completion for pointer and reference to functions.
llvm-svn: 226865
2015-01-22 21:14:08 +00:00
Francisco Lopes da Silva 975a9f6ece Initial support for C++ parameter completion
The improved completion in call context now works with:

 - Functions.
 - Member functions.
 - Constructors.
 - New expressions.
 - Function call expressions.
 - Template variants of the previous.

There are still rough edges to be fixed:

 - Provide support for optional parameters.         (fix known)
 - Provide support for member initializers.         (fix known)
 - Provide support for variadic template functions. (fix unknown)
 - Others?

llvm-svn: 226670
2015-01-21 16:24:11 +00:00
Richard Smith 6eece29d8f PR13699: Include friend declarations in code completion results if they had a
prior visible declaration. Prefer to take template parameter names from the
first declaration.

Testcase from a patch by Francisco Lopes!

llvm-svn: 226083
2015-01-15 02:27:20 +00:00
Yaron Keren af92a37c23 Teach compile_commands.json test that windows-gnu is the new name for mingw32.
llvm-svn: 224426
2014-12-17 11:04:07 +00:00
NAKAMURA Takumi ead8915459 clang/test/Index/usrs.cpp: Appease targeting msvc.
llvm-svn: 223649
2014-12-08 10:20:33 +00:00
Argyrios Kyrtzidis 1d5e542fb2 [libclang] Encode InjectedClassNameType in the USR.
llvm-svn: 223634
2014-12-08 08:48:43 +00:00
Argyrios Kyrtzidis 80537a4146 [libclang] Encode location info for anonymous embedded tag decls.
Otherwise the USR will conflict with different embedded tag decls.

llvm-svn: 223633
2014-12-08 08:48:37 +00:00
Argyrios Kyrtzidis f66cef7575 [libclang] Use same USR encoding for 'class' as 'struct'.
'class' and 'struct' can be used interchangebly for forward references.
Use the same encoding otherwise we may get into a weird situation where the USR for the same
declaration is different based on whether the definition of the tag reference is visible or not.

llvm-svn: 223632
2014-12-08 08:48:33 +00:00
Argyrios Kyrtzidis 0e387dc330 [libclang] Encode C++11 rvalue reference types in the USR.
llvm-svn: 223631
2014-12-08 08:48:27 +00:00
Argyrios Kyrtzidis f581909b3b [libclang] Encode the C++11 method reference qualifier in the USR.
llvm-svn: 223630
2014-12-08 08:48:21 +00:00
Argyrios Kyrtzidis ca044547d2 [libclang] Reflect in USR generation that 'signed char' and 'unsigned char' can overload a 'char' in C++, by giving them distinct encodings.
llvm-svn: 223629
2014-12-08 08:48:17 +00:00
Argyrios Kyrtzidis d06ce400c2 [libclang] Function templates can be 'overloaded' by return type, so encode the return type in the USR
and handle DependentNameType in order to be able to distinguish them.

llvm-svn: 223628
2014-12-08 08:48:11 +00:00
Argyrios Kyrtzidis cde7069ce4 [libclang] Make sure to visit the body of a CXXForRangeStmt.
llvm-svn: 221881
2014-11-13 09:50:19 +00:00
Argyrios Kyrtzidis 998912453d [liblang] Handle CXXForRangeStmt during AST visitation.
llvm-svn: 221874
2014-11-13 09:03:21 +00:00
Argyrios Kyrtzidis 6cc5f73e38 [libclang] When initializing an ObjC object via the "[[ClassName alloc] init*]" pattern,
report the 'init*' invocation as non-dynamic via clang_Cursor_isDynamicCall.

Of course it is dynamic at runtime, but for purposes of indexing we can treat as an invocation to ClassName's init*.

Addresses rdar://18916871.

llvm-svn: 221641
2014-11-10 23:21:35 +00:00
Daniel Jasper 6ef29a36ca clang-format: Fix tests after recent change to ObjC block formatting.
llvm-svn: 220376
2014-10-22 09:50:23 +00:00
Argyrios Kyrtzidis ee301f941c [libclang] If the code-completion point is inside the preamble, adjust the position at the beginning of the file after the preamble.
Otherwise we will not hit the code-completion point.

llvm-svn: 220136
2014-10-18 06:23:50 +00:00
Argyrios Kyrtzidis e62d682a27 [libclang] Allow code-completion when pointing at the end-of-file.
llvm-svn: 220135
2014-10-18 06:19:36 +00:00
Dario Domizioli a60f532a91 Fix for PR21254 - Assertion in comment parser
The size of the ID field in CommandInfo was narrow, leading to potential 
wrap-around of command IDs, causing misinterpretation later on.
The patch does the following:
- It extends the ID bitfield from 8 to 20 bits.
- It provides a DRY definition of the number of bits for the field to 
  avoid using literal numbers in different files.
- It introduces a new assertion that checks for the wrap-around.
- It adds the testcase from PR21254.

llvm-svn: 219802
2014-10-15 16:18:20 +00:00
Eli Bendersky c27a0c490c Add libclang capabilities to retriete template arguments from specializations.
Includes Python bindings.

Reviewed in http://reviews.llvm.org/D5621
Patch by Rob Springer

llvm-svn: 219529
2014-10-10 20:01:05 +00:00
Ben Langmuir c28ce3aba6 Avoid a crash after loading an #undef'd macro in code completion
In code-completion, don't assume there is a MacroInfo for everything,
since we aren't serializing the def corresponding to a later #undef in
the same module.  Also setup the HadMacro bit correctly for undefs to
avoid an assertion failure.

rdar://18416901

llvm-svn: 218694
2014-09-30 20:00:18 +00:00
Alexey Samsonov 3205b51673 Add ubsan/not_ubsan features to Clang lit tests and use
them to exclude tests with large stack usage from UBSan bootstrap.

llvm-svn: 217064
2014-09-03 19:46:32 +00:00
Argyrios Kyrtzidis a2a1e53085 [libclang] Fixup the cursor spelling range for C++ destructors, operator overloads, and conversion functions.
Patch by Craig Tenenbaum!

llvm-svn: 216480
2014-08-26 20:23:26 +00:00
Ben Langmuir e13fd1c430 Fix the rececl chain for redeclarations of predefined decls
Predefined decls like 'Protocol' in objc are not loaded from AST files,
so we cannot rely on loading the canonical decl to complete the redecl
chain for redeclarations of these decls.  The broken redecl chain was
non-circular, so looping over redecls() would hang.

llvm-svn: 215929
2014-08-18 19:32:45 +00:00
NAKAMURA Takumi b6ac3f93e7 clang/test/Index/index-module.m: Tweak expressions to meet dos path on win32.
llvm-svn: 215592
2014-08-13 22:14:49 +00:00
Eli Bendersky 9b07147fc9 Expose the CUDA shared attribute to the C API.
Similar to r209767, which exposed other CUDA-related attributes.

Patch by Rob Springer.

llvm-svn: 215208
2014-08-08 14:59:00 +00:00
Eli Bendersky 7975959569 Add IR Mangler for more stable mangling.
llvm-svn: 214520
2014-08-01 15:01:10 +00:00
Eli Bendersky 44a206f829 Exposes a C API to name mangling for a given cursor.
Inspired by https://gist.github.com/tritao/2766291, and was previously discussed
on cfe-dev: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-June/037577.html

Adding testing capability via c-index-test.

llvm-svn: 214410
2014-07-31 18:04:56 +00:00
Argyrios Kyrtzidis 4f1560242a [test] Add '-target' option to fix bot failure.
llvm-svn: 211439
2014-06-21 18:28:44 +00:00