Commit Graph

795 Commits

Author SHA1 Message Date
Arpith Chacko Jacob 334563d01d [OpenMP] Parsing + sema for target parallel for directive.
Summary:
This patch adds parsing + sema for the target parallel for directive along with testcases.

Reviewers: ABataev

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259654 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-03 15:46:42 +00:00
Arpith Chacko Jacob ed30907f4a [OpenMP] Parsing + sema for target parallel directive.
Summary:
This patch adds parsing + sema for the target parallel directive and its clauses along with testcases.

Reviewers: ABataev

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

Rebased to current trunk and updated test cases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258832 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 18:48:41 +00:00
Arpith Chacko Jacob dc2fa0b050 [OpenMP] Parsing + sema for defaultmap clause.
Summary:
This patch adds parsing + sema for the defaultmap clause associated with the target directive (among others).

Reviewers: ABataev

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258817 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 16:37:23 +00:00
Samuel Antao a064ffc5ba [OpenMP] Detect implicit map type to report unspecified map type for target enter/exit data directives.
Support for the following OpenMP 4.5 restriction on 'target enter data' and 'target exit data':

  - A map-type must be specified in all map clauses.

I have to save 'IsMapTypeImplicit' when parsing a map clause to support this constraint and for more informative error messages. This helps me support the following case:

  #pragma omp target enter data map(r) // expected-error {{map type must be specified for '#pragma omp target enter data'}}

and distinguish it from:

  #pragma omp target enter data map(tofrom: r) // expected-error {{map type 'tofrom' is not allowed for '#pragma omp target enter data'}}

Patch by Arpith Jacob. Thanks!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258179 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 20:40:49 +00:00
Samuel Antao 5243a6feb0 [OpenMP] Parsing + sema for "target exit data" directive.
Patch by Arpith Jacob. Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 20:04:50 +00:00
Samuel Antao faeccf347c [OpenMP] Parsing + sema for "target enter data" directive.
Patch by Arpith Jacob. Thanks!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258165 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 19:15:56 +00:00
Carlo Bertolli 53cb568a9e Add OpenMP dist_schedule clause to distribute directive and related regression tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257917 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 18:50:31 +00:00
Manuel Klimek b1d9c95218 Fix assert hit when tree-transforming template template parameter packs.
Covers significantly more code in the template template pack argument
test and fixes the resulting assert problem.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257326 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 11:39:00 +00:00
Xiuli Pan 97f9428a0d [OpenCL] Pipe type support
Summary:
Support for OpenCL 2.0 pipe type.
This is a bug-fix version for bader's patch reviews.llvm.org/D14441


Reviewers: pekka.jaaskelainen, Anastasia

Subscribers: bader, Anastasia, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257254 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-09 12:53:17 +00:00
Richard Trieu bbef15e5c2 Improve conditional checking during template instantiation.
When the condition in an if statement, while statement, or for loop is created
during template instantiation, it calls MakeFullExpr with only the condition
expression.  However, when these conditions are created for non-templated
code in the Parser, an additional SourceLocation is passed to MakeFullExpr.
The impact of this was that non-dependent templated code could produce
diagnostics that the same code outside templates would not.  Adding the missing
SourceLocation makes diagnostics consistent between templated and non-templated
code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256976 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-06 21:11:18 +00:00
James Y Knight 78eca64919 [TrailingObjects] Convert OffsetOfExpr.
That necessitated moving the OffsetOfNode class out of OffsetOfExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256590 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-29 22:31:18 +00:00
Alexey Bataev d46899a2a4 [OPENMP 4.5] Sema/parsing support for extended format of 'schedule' clause.
OpenMP 4.0-3.1 supports the next format of ‘schedule’ clause: schedule(kind[, chunk_size])
Where kind can be one of ‘static’, ‘dynamic’, ‘guided’, ‘auto’ or ‘runtime’.
OpenMP 4.5 defines the format: schedule([modifier [, modifier]:]kind[, chunk_size])
Modifier can be one of ‘monotonic’, ‘nonmonotonic’ or ‘simd’.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256487 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-28 07:25:51 +00:00
Craig Topper e40e96f682 [Sema] ArrayRef-ize SubstExprs. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256401 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-24 23:58:29 +00:00
Craig Topper 4c7c3a1cdf [Sema] ArrayRef-ize BuildObjCDictionaryLiteral. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256398 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-24 23:58:15 +00:00
Alexey Bataev 41ac0e612d [OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.
OpenMP 4.5 adds 'depend(sink:vec)' in 'ordered' directive for doacross loop synchronization. Patch adds parsing and semantic analysis for this clause.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256330 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-23 10:27:45 +00:00
Alexey Bataev b42a67677c [OPENMP] Revert r256238 to fix the problem with tests on Linux.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256239 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-22 12:44:46 +00:00
Alexey Bataev 00fbd0ddc0 [OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.
OpenMP 4.5 adds 'depend(sink:vec)' in 'ordered' directive for doacross loop synchronization. Patch adds parsing and semantic analysis for this clause.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256238 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-22 12:21:47 +00:00
Alexey Bataev df1b33286d [OPENMP 4.5] Parsing/sema analysis for 'depend(source)' clause in 'ordered' directive.
OpenMP 4.5 adds 'depend(source)' clause for 'ordered' directive to support cross-iteration dependence. Patch adds parsing and semantic analysis for this construct.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255986 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 05:05:56 +00:00
Alexey Bataev ae37251a16 [OPENMP 4.5] Parsing/sema for 'hint' clause of 'critical' directive.
OpenMP 4.5 adds 'hint' clause to critical directive. Patch adds parsing/semantic analysis for this clause.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255625 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15 08:19:24 +00:00
Carlo Bertolli 9ea7936015 Add parse and sema of OpenMP distribute directive with all clauses except dist_schedule
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255498 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14 14:51:25 +00:00
NAKAMURA Takumi 67398e8c8b Revert r255001, "Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule."
It causes memory leak. Some tests in test/OpenMP would fail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255094 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-09 04:35:57 +00:00
Alexey Bataev b3e5ee986e [OPENMP 4.5] Parsing/sema for 'num_tasks' clause.
OpenMP 4.5 adds directives 'taskloop' and 'taskloop simd'. These directives support clause 'num_tasks'. Patch adds parsing/semantic analysis for this clause.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255008 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-08 12:06:20 +00:00
Carlo Bertolli 44e9da2f11 Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-08 04:21:03 +00:00
Alexey Bataev 31fe4a856b [OPENMP 4.5] parsing/sema support for 'grainsize' clause.
OpenMP 4.5 adds 'taksloop' and 'taskloop simd' directives, which have 'grainsize' clause. Patch adds parsing/sema analysis of this clause.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254903 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-07 12:52:51 +00:00
Alexey Bataev 0daec58213 [OPENMP 4.5] parsing/sema support for 'nogroup' clause.
OpenMP 4.5 adds 'taskloop' and 'taskloop simd' directives. These directives have new 'nogroup' clause. Patch adds basic parsing/sema support for this clause.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254899 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-07 10:51:44 +00:00
Alexey Bataev d50b8b580d [OPENMP 4.5] Parsing/sema support for 'omp taskloop simd' directive.
OpenMP 4.5 adds directive 'taskloop simd'. Patch adds parsing/sema analysis for 'taskloop simd' directive and its clauses.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254597 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 09:40:15 +00:00
Alexey Bataev fb742cf95e [OPENMP 4.5] Parsing/sema analysis for 'priority' clause.
OpenMP 4.5 defines new clause 'priority' for 'task', 'taskloop' and 'taskloop simd' directives. Added parsing and sema analysis for 'priority' clause in 'task' and 'taskloop' directives.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254398 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 10:17:31 +00:00
Alexey Bataev 3cddbb56a1 [OPENMP 4.5] Parsing/sema analysis for 'taskloop' directive.
Adds initial parsing and semantic analysis for 'taskloop' directive.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254367 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 04:18:41 +00:00
Kelvin Li 0fafce93c6 [OpenMP] Parsing and sema support for thread_limit clause.
http://reviews.llvm.org/D15029


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254207 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-27 18:47:36 +00:00
Alexey Bataev 0a368f60e7 [MSVC] 'property' with an empty array in array subscript expression.
MSVC supports 'property' attribute and allows to apply it to the declaration of an empty array in a class or structure definition.
For example:
```
__declspec(property(get=GetX, put=PutX)) int x[];
```
The above statement indicates that x[] can be used with one or more array indices. In this case, i=p->x[a][b] will be turned into i=p->GetX(a, b), and p->x[a][b] = i will be turned into p->PutX(a, b, i);
Differential Revision: http://reviews.llvm.org/D13336


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254067 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-25 12:01:00 +00:00
Kelvin Li 1854a566a3 [OpenMP] Parsing and sema support for num_teams clause
http://reviews.llvm.org/D14802


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254019 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-24 20:50:12 +00:00
Kelvin Li e72003e211 [OpenMP] Parsing and sema support for map clause
http://reviews.llvm.org/D14134 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253849 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23 05:32:03 +00:00
Richard Smith ea21696b87 Add support for GCC's '__auto_type' extension, per the GCC manual:
https://gcc.gnu.org/onlinedocs/gcc/Typeof.html

Differences from the GCC extension:
 * __auto_type is also permitted in C++ (but only in places where
   it could appear in C), allowing its use in headers that might
   be shared across C and C++, or used from C++98
 * __auto_type can be combined with a declarator, as with C++ auto
   (for instance, "__auto_type *p")
 * multiple variables can be declared in a single __auto_type
   declaration, with the C++ semantics (the deduced type must be
   the same in each case)

This patch also adds a missing restriction on applying typeof to
a bit-field, which GCC has historically rejected in C (due to
lack of clarity as to whether the operand should be promoted).
The same restriction also applies to __auto_type in C (in both
GCC and Clang).

This also fixes PR25449.

Patch by Nicholas Allegra!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252690 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 02:02:15 +00:00
Richard Smith 1fd6dc6f12 N3922: direct-list-initialization of an auto-typed variable no longer deduces a
std::initializer_list<T> type. Instead, the list must contain a single element
and the type is deduced from that.

In Clang 3.7, we warned by default on all the cases that would change meaning
due to this change. In Clang 3.8, we will support only the new rules -- per
the request in N3922, this change is applied as a Defect Report against earlier
versions of the C++ standard.

This change is not entirely trivial, because for lambda init-captures we
previously did not track the difference between direct-list-initialization and
copy-list-initialization. The difference was not previously observable, because
the two forms of initialization always did the same thing (the elements of the
initializer list were always copy-initialized regardless of the initialization
style used for the init-capture).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252688 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 01:36:17 +00:00
Richard Smith 708f13bd1a [coroutines] Creation of promise object, lookup of operator co_await, building
of await_* calls, and AST representation for same.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251387 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27 06:02:45 +00:00
Richard Smith a78ab22562 [coroutines] Initial stub Sema functionality for handling coroutine await / yield / return.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250993 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 06:13:50 +00:00
Craig Topper f0885ebf48 Use an ArrayRef<OffsetOfComponent> instead of pointer and size throughout offsetof handling code. Also use a range-based for loop. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250989 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 04:59:59 +00:00
Reid Kleckner d903d33591 Re-land r250592 without rejecting field refs in unevaluated contexts
This time, I went with the first approach from
http://reviews.llvm.org/D6700, where clang actually attempts to form an
implicit member reference from an UnresolvedLookupExpr. We know that
there are only two possible outcomes at this point, a DeclRefExpr of the
FieldDecl or an error, but its safer to reuse the existing machinery for
this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250856 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-20 21:04:13 +00:00
Angel Garcia Gomez d162035b9b Roll-back r250822.
Summary: It breaks the build for the ASTMatchers

Subscribers: klimek, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250827 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-20 13:23:58 +00:00
Angel Garcia Gomez e83bf34da9 Apply modernize-use-default to clang.
Summary: Replace empty bodies of default constructors and destructors with '= default'.

Reviewers: bkramer, klimek

Subscribers: klimek, alexfh, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250822 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-20 12:52:55 +00:00
Reid Kleckner 654b758d47 Revert "Diagnose UnresolvedLookupExprs that resolve to instance members in static methods"
This reverts commit r250592.

It has issues around unevaluated contexts, like this:
  template <class T> struct A { T i; };
  template <class T>
  struct B : A<T> {
    using A<T>::i;
    typedef decltype(i) U;
  };
  template struct B<int>;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250774 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-20 00:31:42 +00:00
Reid Kleckner 9da093d0f4 Diagnose UnresolvedLookupExprs that resolve to instance members in static methods
During the initial template parse for this code, 'member' is unresolved
and we don't know anything about it:

  struct A { int member };
  template <typename T>
  struct B : public T {
    using T::member;
    static void f() {
      (void)member; // Could be static or non-static.
    }
  };
  template class B<A>;

The pattern declaration contains an UnresolvedLookupExpr rather than an
UnresolvedMemberExpr because `f` is static, and `member` should never be
a field. However, if the code is invalid, it may become a field, in
which case we should diagnose it.

Reviewers: rjmccall, rsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250592 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-17 00:19:04 +00:00
Hans Wennborg 5e171f9c91 Fix Clang-tidy modernize-use-nullptr warnings in headers and generated files; other minor cleanups.
By Eugene Zelenko!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248828 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29 20:56:43 +00:00
Alexey Bataev 552e1f3b9b [OPENMP 4.1] Add 'simd' clause for 'ordered' directive.
Parsing and sema analysis for 'simd' clause in 'ordered' directive.
Description
If the simd clause is specified, the ordered regions encountered by any thread will use only a single SIMD lane to execute the ordered
regions in the order of the loop iterations.
Restrictions
An ordered construct with the simd clause is the only OpenMP construct that can appear in the simd region



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248696 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-28 06:39:35 +00:00
Alexey Bataev b1fbc23058 [OPENMP 4.1] Add 'threads' clause for '#pragma omp ordered'.
OpenMP 4.1 extends format of '#pragma omp ordered'. It adds 3 additional clauses: 'threads', 'simd' and 'depend'.
If no clause is specified, the ordered construct behaves as if the threads clause had been specified. If the threads clause is specified, the threads in the team executing the loop region execute ordered regions sequentially in the order of the loop iterations.
The loop region to which an ordered region without any clause or with a threads clause binds must have an ordered clause without the parameter specified on the corresponding loop directive.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248569 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-25 10:37:12 +00:00
Richard Smith 1878f91a0a PR14858: Initial support for proper sizeof... handling within alias templates.
This doesn't quite get alias template equivalence right yet, but handles the
egregious cases where we would silently give the wrong answers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 21:41:42 +00:00
Alexey Bataev 878fd7ec17 [OPENMP 4.1] Parsing/sema analysis for extended format of 'if' clause.
OpenMP 4.1 added special 'directive-name-modifier' to the 'if' clause.
Format of 'if' clause is as follows:
```
if([ directive-name-modifier :] scalar-logical-expression)
```

The restriction rules are also changed.
1. If any 'if' clause on the directive includes a 'directive-name-modifier' then all 'if' clauses on the directive must include a 'directive-name-modifier'.
2. At most one 'if' clause without a 'directive-name-modifier' can appear on the directive.
3. At most one 'if' clause with some particular 'directive-name-modifier' can appear on the directive.

'directive-name-modifier' is important for combined directives and allows to separate conditions in 'if' clause for simple sub-directives in combined directive. This 'directive-name-modifier' identifies the sub-directive to which this 'if' clause must be applied.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246747 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03 07:23:48 +00:00
Hubert Tong c10233869c Fix assertion failure in TransformOpaqueValueExpr
Summary:
`OpaqueValueExpr`s may not have a source expression (as in the case when
they are created due to a default argument error).
This can cause an assertion failure in `TransformOpaqueValueExpr` during
template instantiation.

This patch fixes the assertion failure.

Reviewers: hfinkel, rsmith

Subscribers: fraggamuffin, cfe-commits

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

Patch by Rachel Craik!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246600 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01 22:50:31 +00:00
Aaron Ballman e2415b5e4b Add a new frontend warning for referencing members from the handler of a constructor or destructor function-try-block, which is UB in C++.
This corresponds to the CERT secure coding rule ERR53-CPP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246548 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01 14:49:24 +00:00
Alexey Bataev 4de8211781 [OPENMP 4.0] Initial support for array sections.
Adds parsing/sema analysis/serialization/deserialization for array sections in OpenMP constructs (introduced in OpenMP 4.0).
Currently it is allowed to use array sections only in OpenMP clauses that accepts list of expressions.
Differential Revision: http://reviews.llvm.org/D10732


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245937 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 14:24:04 +00:00