Commit Graph

532 Commits

Author SHA1 Message Date
Emilio Cobos Alvarez 485ad42521 [libclang] Expose some target information via the C API.
This allows users to query the target triple and target pointer width, which
would make me able to fix https://github.com/servo/rust-bindgen/issues/593 and
other related bugs in an elegant way (without having to manually parse the
target triple in the command line arguments).

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

llvm-svn: 301648
2017-04-28 15:56:39 +00:00
Argyrios Kyrtzidis 2a68486c8f [libclang] Enhance clang_Cursor_isDynamicCall and clang_Cursor_getReceiverType to handle ObjC property references
Also enhance clang_Cursor_getReceiverType to handle C++ method calls.

llvm-svn: 301568
2017-04-27 17:23:04 +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 6c2898a3e9 Avoid the -Wdocumentation-unknown-command warning in Clang's C API docs
rdar://20441985

llvm-svn: 299650
2017-04-06 14:03:25 +00:00
Vassil Vassilev 4b8e29d516 PR16106: Correct the docs to reflect the actual behavior of the interface.
llvm-svn: 299639
2017-04-06 10:05:46 +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
Joey Gouly 6ea21852af [libclang] [OpenCL] Expose half type.
Expose the half type (fp16) through libclang and the python bindings.

It seems CXType_LastBuiltin was not updated in b2ea6d9 ("Enable
support for __float128 in Clang", 2016-04-13), so update it now.

Add an Index test for OpenCL types; in the future we will add other
OpenCL types such as images to this test.

Patch by Sven van Haastregt.

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

llvm-svn: 294754
2017-02-10 15:51:11 +00:00
Kelvin Li da68118729 [OpenMP] Sema and parsing for 'target teams distribute simd’ pragma
This patch is to implement sema and parsing for 'target teams distribute simd’ pragma.
    
Differential Revision: https://reviews.llvm.org/D28252

llvm-svn: 291579
2017-01-10 18:08:18 +00:00
Kelvin Li 1851df563d [OpenMP] Sema and parsing for 'target teams distribute parallel for simd’ pragma
This patch is to implement sema and parsing for 'target teams distribute parallel for simd’ pragma.

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

llvm-svn: 290862
2017-01-03 05:23:48 +00:00
Kelvin Li 80e8f56284 [OpenMP] Sema and parsing for 'target teams distribute parallel for’ pragma
This patch is to implement sema and parsing for 'target teams distribute parallel for’ pragma.

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

llvm-svn: 290725
2016-12-29 22:16:30 +00:00
Kelvin Li 83c451e998 [OpenMP] Sema and parsing for 'target teams distribute' pragma
This patch is to implement sema and parsing for 'target teams distribute' pragma.

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

llvm-svn: 290508
2016-12-25 04:52:54 +00:00
Kelvin Li bf594a5600 [OpenMP] Sema and parsing for 'target teams' pragma
This patch is to implement sema and parsing for 'target teams' pragma.

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

llvm-svn: 290038
2016-12-17 05:48:59 +00:00
Samuel Antao 4c8035bca4 Fix format and a few typos in comments.
llvm-svn: 289450
2016-12-12 18:00:20 +00:00
Kelvin Li 7ade93f5e2 [OpenMP] Sema and parsing for 'teams distribute parallel for' pragma
This patch is to implement sema and parsing for 'teams distribute parallel for' pragma.
    
Differential Revision: https://reviews.llvm.org/D27345

llvm-svn: 289179
2016-12-09 03:24:30 +00:00
Argyrios Kyrtzidis 5dda1128f1 [libclang] Add APIs to check the result of an integer expression in CXEvalResult without overflow
Patch by Emilio Cobos Álvarez!
See https://reviews.llvm.org/D26788

llvm-svn: 288438
2016-12-01 23:41:27 +00:00
Kelvin Li 579e41ced2 [OpenMP] Sema and parsing for 'teams distribute parallel for simd' pragma
This patch is to implement sema and parsing for 'teams distribute parallel for simd' pragma.

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

llvm-svn: 288294
2016-11-30 23:51:03 +00:00
Argyrios Kyrtzidis 35f5aab4d7 [libclang] Generalize clang_getNumTemplateArguments and clang_getTemplateArgumentAsType to other kind of specializations.
Patch by Emilio Cobos Álvarez!
https://reviews.llvm.org/D26663

llvm-svn: 287024
2016-11-15 20:51:46 +00:00
Olivier Goffart d211c648b9 [index] Expose FriendDecl
Differential Revision: https://reviews.llvm.org/D26285

llvm-svn: 285984
2016-11-04 06:29:27 +00:00
Erich Keane 757d317c24 regcall: Implement regcall Calling Conv in clang
This patch implements the register call calling convention, which ensures
as many values as possible are passed in registers. CodeGen changes
were committed in https://reviews.llvm.org/rL284108.

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

llvm-svn: 285849
2016-11-02 18:29:35 +00:00
Kelvin Li 4e325f77a9 Re-apply patch r279045.
llvm-svn: 285066
2016-10-25 12:50:55 +00:00
Cameron Desrochers d80912871d [libclang] Add clang_getAllSkippedRanges function
This complements the clang_getSkippedRanges function which returns skipped ranges filtered by a specific file.

This function is useful when all the ranges are desired (and a lot more efficient than the equivalent of asking for the ranges file by file, since the implementation of clang_getSkippedRanges iterates over all ranges anyway).

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

llvm-svn: 279076
2016-08-18 15:43:55 +00:00
Diana Picus 8b44bbc077 Revert "[OpenMP] Sema and parsing for 'teams distribute simd’ pragma"
This reverts commit r279003 as it breaks some of our buildbots (e.g.
clang-cmake-aarch64-quick, clang-x86_64-linux-selfhost-modules).

The error is in OpenMP/teams_distribute_simd_ast_print.cpp:
clang: /home/buildslave/buildslave/clang-cmake-aarch64-quick/llvm/include/llvm/ADT/DenseMap.h:527:
bool llvm::DenseMapBase<DerivedT, KeyT, ValueT, KeyInfoT, BucketT>::LookupBucketFor(const LookupKeyT&, const BucketT*&) const
[with LookupKeyT = clang::Stmt*; DerivedT = llvm::DenseMap<clang::Stmt*, long unsigned int>;
      KeyT = clang::Stmt*; ValueT = long unsigned int;
      KeyInfoT = llvm::DenseMapInfo<clang::Stmt*>;
      BucketT = llvm::detail::DenseMapPair<clang::Stmt*, long unsigned int>]:
Assertion `!KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val, TombstoneKey) &&
"Empty/Tombstone value shouldn't be inserted into map!"' failed.

llvm-svn: 279045
2016-08-18 09:25:07 +00:00
Kelvin Li 0e3bde8216 [OpenMP] Sema and parsing for 'teams distribute simd’ pragma
This patch is to implement sema and parsing for 'teams distribute simd’ pragma.

This patch is originated by Carlo Bertolli.

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

llvm-svn: 279003
2016-08-17 23:13:03 +00:00
Kelvin Li 0253287633 [OpenMP] Sema and parsing for 'teams distribute' pragma
This patch is to implement sema and parsing for 'teams distribute' pragma.

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

llvm-svn: 277818
2016-08-05 14:37:37 +00:00
Kelvin Li 986330c190 [OpenMP] Sema and parsing for 'target simd' pragma
This patch is to implement sema and parsing for 'target simd' pragma.

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

llvm-svn: 276203
2016-07-20 22:57:10 +00:00
Erik Pilkington 29099ded0c [ObjC] Implement @available in the Parser and AST
This patch adds a new AST node: ObjCAvailabilityCheckExpr, and teaches the
Parser and Sema to generate it. This node represents an availability check of
the form:

  @available(macos 10.10, *);

Which will eventually compile to a runtime check of the host's OS version. This
is the first patch of the feature I proposed here:
http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html

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

llvm-svn: 275654
2016-07-16 00:35:23 +00:00
Kelvin Li a579b9196c [OpenMP] Sema and parsing for 'target parallel for simd' pragma
This patch is to implement sema and parsing for 'target parallel for simd' pragma.

Differential Revision: http://reviews.llvm.org/D22096

llvm-svn: 275365
2016-07-14 02:54:56 +00:00
Kelvin Li 787f3fcc6b [OpenMP] Sema and parsing for 'distribute simd' pragma
Summary: This patch is an implementation of sema and parsing for the OpenMP composite pragma 'distribute simd'.

Differential Revision: http://reviews.llvm.org/D22007

llvm-svn: 274604
2016-07-06 04:45:38 +00:00
Kelvin Li 4a39add05e [OpenMP] Sema and parse for 'distribute parallel for simd'
Summary: This patch is an implementation of sema and parsing for the OpenMP composite pragma 'distribute parallel for simd'.

Differential Revision: http://reviews.llvm.org/D21977

llvm-svn: 274530
2016-07-05 05:00:15 +00:00
Manman Ren ccf25bbf3f AvailabilityAttr: we accept "macos" as the platform name.
We continue accepting "macosx" but canonicalize it to "macos", When emitting
diagnostics, we use "macOS" instead of "OS X".

The PlatformName in TargetInfo is changed from "macosx" to "macos" so we can
directly compare the Platform in AvailabilityAttr with the PlatformName
in TargetInfo.

rdar://26795172
rdar://26800775

llvm-svn: 274064
2016-06-28 20:55:30 +00:00
Carlo Bertolli 9925f15661 Resubmission of http://reviews.llvm.org/D21564 after fixes.
[OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'

This patch is an initial implementation for #distribute parallel for.
The main differences that affect other pragmas are:

The implementation of 'distribute parallel for' requires blocking of the associated loop, where blocks are "distributed" to different teams and iterations within each block are scheduled to parallel threads within each team. To implement blocking, sema creates two additional worksharing directive fields that are used to pass the team assigned block lower and upper bounds through the outlined function resulting from 'parallel'. In this way, scheduling for 'for' to threads can use those bounds.
As a consequence of blocking, the stride of 'distribute' is not 1 but it is equal to the blocking size. This is returned by the runtime and sema prepares a DistIncrExpr variable to hold that value.
As a consequence of blocking, the global upper bound (EnsureUpperBound) expression of the 'for' is not the original loop upper bound (e.g. in for(i = 0 ; i < N; i++) this is 'N') but it is the team-assigned block upper bound. Sema creates a new expression holding the calculation of the actual upper bound for 'for' as UB = min(UB, PrevUB), where UB is the loop upper bound, and PrevUB is the team-assigned block upper bound.

llvm-svn: 273884
2016-06-27 14:55:37 +00:00
Carlo Bertolli b8503d5399 Revert r273705
[OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'

llvm-svn: 273709
2016-06-24 19:20:02 +00:00
Carlo Bertolli e77d6e0e4d [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'
http://reviews.llvm.org/D21564

This patch is an initial implementation for #distribute parallel for.
The main differences that affect other pragmas are:

The implementation of 'distribute parallel for' requires blocking of the associated loop, where blocks are "distributed" to different teams and iterations within each block are scheduled to parallel threads within each team. To implement blocking, sema creates two additional worksharing directive fields that are used to pass the team assigned block lower and upper bounds through the outlined function resulting from 'parallel'. In this way, scheduling for 'for' to threads can use those bounds.
As a consequence of blocking, the stride of 'distribute' is not 1 but it is equal to the blocking size. This is returned by the runtime and sema prepares a DistIncrExpr variable to hold that value.
As a consequence of blocking, the global upper bound (EnsureUpperBound) expression of the 'for' is not the original loop upper bound (e.g. in for(i = 0 ; i < N; i++) this is 'N') but it is the team-assigned block upper bound. Sema creates a new expression holding the calculation of the actual upper bound for 'for' as UB = min(UB, PrevUB), where UB is the loop upper bound, and PrevUB is the team-assigned block upper bound.

llvm-svn: 273705
2016-06-24 18:53:35 +00:00
Alexey Bataev 61deb4dadc Revert accidential "[MSVC] Late parsing of in-class defined member functions in template"
This reverts commit 0253605771b8bd9d414aba74fe2742c730d6fd1a.

llvm-svn: 272776
2016-06-15 11:24:54 +00:00
Alexey Bataev 86e786bd17 [MSVC] Late parsing of in-class defined member functions in template
classes.

MSVC actively uses unqualified lookup in dependent bases, lookup at the
instantiation point (non-dependent names may be resolved on things
declared later) etc. and all this stuff is the main cause of
incompatibility between clang and MSVC.

Clang tries to emulate MSVC behavior but it may fail in many cases.
clang could store lexed tokens for member functions definitions within
ClassTemplateDecl for later parsing during template instantiation.

It will allow resolving many possible issues with lookup in dependent
base classes and removing many already existing MSVC-specific
hacks/workarounds from the clang code.

llvm-svn: 272774
2016-06-15 11:19:39 +00:00
Olivier Goffart 692d533100 Make sizeof and alignof a CXCursor_UnaryExpr
So we can match sizeof expressions more accurately than with UnexposedExpr

Differential Revision: http://reviews.llvm.org/D18081

llvm-svn: 272274
2016-06-09 16:16:06 +00:00
Olivier Goffart 81978014c5 CIndex: add support for static_assert
Differential Revision: http://reviews.llvm.org/D18080

llvm-svn: 272273
2016-06-09 16:15:55 +00:00
Manman Ren 400e4c34d3 Bump libclang API minor version after r271351.
Also use the next enum value for CXObjCPropertyAttr_class.

llvm-svn: 271747
2016-06-03 23:11:41 +00:00
Manman Ren 04fd4d8bae Indexer: add CXObjCPropertyAttr_class for class properties.
rdar://25963227

llvm-svn: 271351
2016-05-31 23:22:04 +00:00
Ehsan Akhgari b743de7fb9 clang-c: Add the clang_getCursorVisibility() API
This patch adds an API for querying the visibility of the entity
referred to by a cursor.

Patch by Michael Wu <mwu@mozilla.com>.

llvm-svn: 271292
2016-05-31 15:55:51 +00:00
Ehsan Akhgari 3a562e6f70 Revert r253909 because it was committed with an incorrect message
llvm-svn: 271291
2016-05-31 15:39:10 +00:00
Samuel Antao 686c70c3dc [OpenMP] Parsing and sema support for target update directive
Summary:
This patch is to add parsing and sema support for `target update` directive. Support for the `to` and `from` clauses will be added by a different patch.  This patch also adds support for other clauses that are already implemented upstream and apply to `target update`, e.g. `device` and `if`.

This patch is based on the original post by Kelvin Li.

Reviewers: hfinkel, carlo.bertolli, kkwli0, arpith-jacob, ABataev

Subscribers: caomhin, cfe-commits

Differential Revision: http://reviews.llvm.org/D15944

llvm-svn: 270878
2016-05-26 17:30:50 +00:00
Saleem Abdulrasool ec988b76cc clang-c: de-anonymize structure declaration
The statement constructed an anonymous structure which was typedefed.  The
anonymous structure has internal linkage, and that would cause an error when
building with modules.  Give the type declaration a tag name to address the
error when building with modules.

llvm-svn: 270520
2016-05-24 01:23:24 +00:00
Nemanja Ivanovic bb1ea2d613 Enable support for __float128 in Clang and enable it on pertinent platforms
This patch corresponds to reviews:
http://reviews.llvm.org/D15120
http://reviews.llvm.org/D19125

It adds support for the __float128 keyword, literals and target feature to
enable it. Based on the latter of the two aforementioned reviews, this feature
is enabled on Linux on i386/X86 as well as SystemZ.
This is also the second attempt in commiting this feature. The first attempt
did not enable it on required platforms which caused failures when compiling
type_traits with -std=gnu++11.

If you see failures with compiling this header on your platform after this
commit, it is likely that your platform needs to have this feature enabled.

llvm-svn: 268898
2016-05-09 08:52:33 +00:00
Sergey Kalinichev 69770aee36 [libclang] Expose the ElaboratedType
Differential Revision: http://reviews.llvm.org/D11797

llvm-svn: 268366
2016-05-03 06:58:29 +00:00
Jonathan Coe 2956535b7c Expose cxx constructor and method properties through libclang and python bindings.
Summary:
I have exposed the following function through libclang and the clang.cindex python bindings:

clang_CXXConstructor_isConvertingConstructor,
clang_CXXConstructor_isCopyConstructor,
clang_CXXConstructor_isDefaultConstructor,
clang_CXXConstructor_isMoveConstructor,
clang_CXXMethod_isDefaulted

I need (some of) these methods for a C++ code model I am building in Python to drive a code generator.

Reviewers: compnerd, skalinichev

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D15469

llvm-svn: 267706
2016-04-27 12:48:25 +00:00
Nemanja Ivanovic d7d45bf8ce Revert 266186 as it breaks anything that includes type_traits on some platforms
Since this patch provided support for the __float128 type but disabled it
on all platforms by default, some platforms can't compile type_traits with
-std=gnu++11 since there is a specialization with __float128.
This reverts the patch until D19125 is approved (i.e. we know which platforms
need this support enabled).

llvm-svn: 266460
2016-04-15 18:04:13 +00:00
Nemanja Ivanovic 50f29e06a1 Enable support for __float128 in Clang
This patch corresponds to review:
http://reviews.llvm.org/D15120

It adds support for the __float128 keyword, literals and a target feature to
enable it. This support is disabled by default on all targets and any target
that has support for this type is free to add it.

Based on feedback that I've received from target maintainers, this appears to
be the right thing for most targets. I have not heard from the maintainers of
X86 which I believe supports this type. I will subsequently investigate the
impact of enabling this on X86.

llvm-svn: 266186
2016-04-13 09:49:45 +00:00
Vedant Kumar cbfe7bb72e Fix a typo, Tiles -> Files, NFC
llvm-svn: 264218
2016-03-23 23:51:36 +00:00
Roman Levenstein 35aa5cecf2 Add attributes for preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end
Till now, preserve_mostcc/preserve_allcc calling convention attributes were only
available at the LLVM IR level. This patch adds attributes for
preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end.

The code was mostly written by Juergen Ributzka.
I just added support for the AArch64 target and tests.

Differential Revision: http://reviews.llvm.org/D18025

llvm-svn: 263647
2016-03-16 18:00:46 +00:00