r259366 - [OpenMP] Prevent nesting of target constructs within target code execution regions.

Kostya Serebryany via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 1 13:48:23 PST 2016


We are seeing failures on the bots, likely related to this patch. Please
take a look ASAP.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/9806/steps/check-clang%20ubsan/logs/stdio

/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Sema/SemaOpenMP.cpp:2683:25:
runtime error: load of value 419385984, which is not a valid value for
type 'clang::OpenMPDirectiveKind'

--kcc

On Mon, Feb 1, 2016 at 8:32 AM, Arpith Chacko Jacob via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: arpith
> Date: Mon Feb  1 10:32:47 2016
> New Revision: 259366
>
> URL: http://llvm.org/viewvc/llvm-project?rev=259366&view=rev
> Log:
> [OpenMP] Prevent nesting of target constructs within target code execution
> regions.
>
> Summary:
> This patch enhances Sema to check for the following restriction:
>
> OpenMP 4.5 [2.17 Nesting of Regions]
> If a target, target update, target data, target enter data, or
> target exit data construct is encountered during execution of a
> target region, the behavior is unspecified.
>
> Reviewers: ABataev
>
> Differential Revision: http://reviews.llvm.org/D16758
>
>
> Modified:
>     cfe/trunk/include/clang/Basic/OpenMPKinds.h
>     cfe/trunk/lib/Basic/OpenMPKinds.cpp
>     cfe/trunk/lib/Sema/SemaOpenMP.cpp
>     cfe/trunk/test/OpenMP/distribute_private_messages.cpp
>     cfe/trunk/test/OpenMP/nesting_of_regions.cpp
>     cfe/trunk/test/OpenMP/target_data_device_messages.cpp
>     cfe/trunk/test/OpenMP/target_device_messages.cpp
>     cfe/trunk/test/OpenMP/target_if_messages.cpp
>     cfe/trunk/test/OpenMP/target_messages.cpp
>     cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp
>     cfe/trunk/test/OpenMP/target_parallel_device_messages.cpp
>     cfe/trunk/test/OpenMP/target_parallel_firstprivate_messages.cpp
>     cfe/trunk/test/OpenMP/target_parallel_if_messages.cpp
>     cfe/trunk/test/OpenMP/target_parallel_map_messages.cpp
>     cfe/trunk/test/OpenMP/target_parallel_messages.cpp
>     cfe/trunk/test/OpenMP/target_parallel_num_threads_messages.cpp
>     cfe/trunk/test/OpenMP/target_parallel_private_messages.cpp
>     cfe/trunk/test/OpenMP/target_parallel_proc_bind_messages.cpp
>     cfe/trunk/test/OpenMP/target_parallel_reduction_messages.cpp
>     cfe/trunk/test/OpenMP/target_parallel_shared_messages.cpp
>     cfe/trunk/test/OpenMP/target_private_messages.cpp
>     cfe/trunk/test/OpenMP/teams_reduction_messages.cpp
>
> Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.h?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/OpenMPKinds.h (original)
> +++ cfe/trunk/include/clang/Basic/OpenMPKinds.h Mon Feb  1 10:32:47 2016
> @@ -156,11 +156,20 @@ bool isOpenMPTaskLoopDirective(OpenMPDir
>  /// parallel', otherwise - false.
>  bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind);
>
> -/// \brief Checks if the specified directive is a target-kind directive.
> +/// \brief Checks if the specified directive is a target code offload
> directive.
>  /// \param DKind Specified directive.
> -/// \return true - the directive is a target-like directive like 'omp
> target',
> +/// \return true - the directive is a target code offload directive like
> +/// 'omp target', 'omp target parallel', 'omp target xxx'
>  /// otherwise - false.
> -bool isOpenMPTargetDirective(OpenMPDirectiveKind DKind);
> +bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind);
> +
> +/// \brief Checks if the specified directive is a target data offload
> directive.
> +/// \param DKind Specified directive.
> +/// \return true - the directive is a target data offload directive like
> +/// 'omp target data', 'omp target update', 'omp target enter data',
> +/// 'omp target exit data'
> +/// otherwise - false.
> +bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind);
>
>  /// \brief Checks if the specified directive is a teams-kind directive.
>  /// \param DKind Specified directive.
>
> Modified: cfe/trunk/lib/Basic/OpenMPKinds.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/OpenMPKinds.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Basic/OpenMPKinds.cpp (original)
> +++ cfe/trunk/lib/Basic/OpenMPKinds.cpp Mon Feb  1 10:32:47 2016
> @@ -576,8 +576,15 @@ bool clang::isOpenMPParallelDirective(Op
>           // TODO add next directives.
>  }
>
> -bool clang::isOpenMPTargetDirective(OpenMPDirectiveKind DKind) {
> -  return DKind == OMPD_target; // TODO add next directives.
> +bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) {
> +  // TODO add next directives.
> +  return DKind == OMPD_target || DKind == OMPD_target_parallel;
> +}
> +
> +bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind
> DKind) {
> +  // TODO add target update directive check.
> +  return DKind == OMPD_target_data || DKind == OMPD_target_enter_data ||
> +         DKind == OMPD_target_exit_data;
>  }
>
>  bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
>
> Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Feb  1 10:32:47 2016
> @@ -809,7 +809,7 @@ bool Sema::IsOpenMPCapturedByRef(ValueDe
>    auto DKind = DSAStack->getDirectiveForScope(RSI->TheScope);
>    auto Ty = D->getType();
>
> -  if (isOpenMPTargetDirective(DKind)) {
> +  if (isOpenMPTargetExecutionDirective(DKind)) {
>      // This table summarizes how a given variable should be passed to the
> device
>      // given its type and the clauses where it appears. This table is
> based on
>      // the description in OpenMP 4.5 [2.10.4, target Construct] and
> @@ -907,7 +907,7 @@ bool Sema::IsOpenMPCapturedDecl(ValueDec
>          DSAStack->hasDirective(
>              [](OpenMPDirectiveKind K, const DeclarationNameInfo &DNI,
>                 SourceLocation Loc) -> bool {
> -              return isOpenMPTargetDirective(K);
> +              return isOpenMPTargetExecutionDirective(K);
>              },
>              false)) {
>        return true;
> @@ -944,7 +944,8 @@ bool Sema::isOpenMPTargetCapturedDecl(Va
>
>    auto *VD = dyn_cast<VarDecl>(D);
>    return VD && !VD->hasLocalStorage() &&
> -         DSAStack->hasExplicitDirective(isOpenMPTargetDirective, Level);
> +         DSAStack->hasExplicitDirective(isOpenMPTargetExecutionDirective,
> +                                        Level);
>  }
>
>  void Sema::DestroyDataSharingAttributesStack() { delete DSAStack; }
> @@ -2313,11 +2314,11 @@ static bool CheckNestingOfRegions(Sema &
>    // | target           | flush           | *
>       |
>    // | target           | ordered         | *
>       |
>    // | target           | atomic          | *
>       |
> -  // | target           | target          | *
>       |
> -  // | target           | target parallel | *
>       |
> -  // | target           | target enter    | *
>       |
> +  // | target           | target          |
>       |
> +  // | target           | target parallel |
>       |
> +  // | target           | target enter    |
>       |
>    // |                  | data            |
>       |
> -  // | target           | target exit     | *
>       |
> +  // | target           | target exit     |
>       |
>    // |                  | data            |
>       |
>    // | target           | teams           | *
>       |
>    // | target           | cancellation    |
>       |
> @@ -2347,11 +2348,11 @@ static bool CheckNestingOfRegions(Sema &
>    // | target parallel  | flush           | *
>       |
>    // | target parallel  | ordered         | *
>       |
>    // | target parallel  | atomic          | *
>       |
> -  // | target parallel  | target          | *
>       |
> -  // | target parallel  | target parallel | *
>       |
> -  // | target parallel  | target enter    | *
>       |
> +  // | target parallel  | target          |
>       |
> +  // | target parallel  | target parallel |
>       |
> +  // | target parallel  | target enter    |
>       |
>    // |                  | data            |
>       |
> -  // | target parallel  | target exit     | *
>       |
> +  // | target parallel  | target exit     |
>       |
>    // |                  | data            |
>       |
>    // | target parallel  | teams           |
>       |
>    // | target parallel  | cancellation    |
>       |
> @@ -2498,6 +2499,7 @@ static bool CheckNestingOfRegions(Sema &
>    //
> +------------------+-----------------+------------------------------------+
>    if (Stack->getCurScope()) {
>      auto ParentRegion = Stack->getParentDirective();
> +    auto OffendingRegion = ParentRegion;
>      bool NestingProhibited = false;
>      bool CloseNesting = true;
>      enum {
> @@ -2658,10 +2660,32 @@ static bool CheckNestingOfRegions(Sema &
>        NestingProhibited = !isOpenMPTeamsDirective(ParentRegion);
>        Recommend = ShouldBeInTeamsRegion;
>      }
> +    if (!NestingProhibited &&
> +        (isOpenMPTargetExecutionDirective(CurrentRegion) ||
> +         isOpenMPTargetDataManagementDirective(CurrentRegion))) {
> +      // OpenMP 4.5 [2.17 Nesting of Regions]
> +      // If a target, target update, target data, target enter data, or
> +      // target exit data construct is encountered during execution of a
> +      // target region, the behavior is unspecified.
> +      OpenMPDirectiveKind PreviousTargetExecutionDirective;
> +      NestingProhibited = Stack->hasDirective(
> +          [&PreviousTargetExecutionDirective](OpenMPDirectiveKind K,
> +                                              const DeclarationNameInfo
> &DNI,
> +                                              SourceLocation Loc) -> bool
> {
> +            if (isOpenMPTargetExecutionDirective(K)) {
> +              PreviousTargetExecutionDirective = K;
> +              return true;
> +            } else
> +              return false;
> +          },
> +          false /* don't skip top directive */);
> +      CloseNesting = false;
> +      OffendingRegion = PreviousTargetExecutionDirective;
> +    }
>      if (NestingProhibited) {
>        SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region)
> -          << CloseNesting << getOpenMPDirectiveName(ParentRegion) <<
> Recommend
> -          << getOpenMPDirectiveName(CurrentRegion);
> +          << CloseNesting << getOpenMPDirectiveName(OffendingRegion)
> +          << Recommend << getOpenMPDirectiveName(CurrentRegion);
>        return true;
>      }
>    }
>
> Modified: cfe/trunk/test/OpenMP/distribute_private_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/distribute_private_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/distribute_private_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/distribute_private_messages.cpp Mon Feb  1
> 10:32:47 2016
> @@ -98,6 +98,7 @@ int main(int argc, char **argv) {
>    #pragma omp target
>    #pragma omp teams firstprivate(i)
>    #pragma omp parallel private(i)
> +  {}
>    #pragma omp target
>    #pragma omp teams reduction(+:i)
>    #pragma omp distribute private(i)
> @@ -113,20 +114,20 @@ int main(int argc, char **argv) {
>    #pragma omp teams
>    #pragma omp distribute firstprivate(i)
>    for (int k = 0; k < 10; ++k) {
> -    #pragma omp target
> -    #pragma omp teams firstprivate(i)
> -    #pragma omp distribute private(i)
> -    for (int x = 0; x < 10; ++x) foo();
>    }
>    #pragma omp target
> +  #pragma omp teams firstprivate(i)
> +  #pragma omp distribute private(i)
> +  for (int x = 0; x < 10; ++x) foo();
> +  #pragma omp target
>    #pragma omp teams reduction(+:i)
>    #pragma omp distribute
>    for (int k = 0; k < 10; ++k) {
> -    #pragma omp target
> -    #pragma omp teams reduction(+:i)
> -    #pragma omp distribute private(i)
> -    for (int x = 0; x < 10; ++x) foo();
>    }
> +  #pragma omp target
> +  #pragma omp teams reduction(+:i)
> +  #pragma omp distribute private(i)
> +  for (int x = 0; x < 10; ++x) foo();
>
>    return 0;
>  }
>
> Modified: cfe/trunk/test/OpenMP/nesting_of_regions.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nesting_of_regions.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/nesting_of_regions.cpp (original)
> +++ cfe/trunk/test/OpenMP/nesting_of_regions.cpp Mon Feb  1 10:32:47 2016
> @@ -2666,12 +2666,12 @@ void foo() {
>    }
>  #pragma omp target
>    {
> -#pragma omp target
> +#pragma omp target // expected-error {{region cannot be nested inside
> 'target' region}}
>      ++a;
>    }
>  #pragma omp target
>    {
> -#pragma omp target parallel
> +#pragma omp target parallel // expected-error {{region cannot be nested
> inside 'target' region}}
>      ++a;
>    }
>  #pragma omp target
> @@ -2699,11 +2699,11 @@ void foo() {
>    }
>  #pragma omp target
>    {
> -#pragma omp target enter data map(to: a)
> +#pragma omp target enter data map(to: a) // expected-error {{region
> cannot be nested inside 'target' region}}
>    }
>  #pragma omp target
>    {
> -#pragma omp target exit data map(from: a)
> +#pragma omp target exit data map(from: a) // expected-error {{region
> cannot be nested inside 'target' region}}
>    }
>
>  // TARGET PARALLEL DIRECTIVE
> @@ -2796,12 +2796,12 @@ void foo() {
>    }
>  #pragma omp target parallel
>    {
> -#pragma omp target
> +#pragma omp target // expected-error {{region cannot be nested inside
> 'target parallel' region}}
>      ++a;
>    }
>  #pragma omp target parallel
>    {
> -#pragma omp target parallel
> +#pragma omp target parallel // expected-error {{region cannot be nested
> inside 'target parallel' region}}
>      ++a;
>    }
>  #pragma omp target parallel
> @@ -2829,11 +2829,11 @@ void foo() {
>    }
>  #pragma omp target parallel
>    {
> -#pragma omp target enter data map(to: a)
> +#pragma omp target enter data map(to: a) // expected-error {{region
> cannot be nested inside 'target parallel' region}}
>    }
>  #pragma omp target parallel
>    {
> -#pragma omp target exit data map(from: a)
> +#pragma omp target exit data map(from: a) // expected-error {{region
> cannot be nested inside 'target parallel' region}}
>    }
>
>  // TEAMS DIRECTIVE
> @@ -2952,7 +2952,7 @@ void foo() {
>  #pragma omp target
>  #pragma omp teams
>    {
> -#pragma omp target parallel
> +#pragma omp target parallel // expected-error {{region cannot be nested
> inside 'target' region}}
>      ++a;
>    }
>  #pragma omp target
> @@ -3337,28 +3337,28 @@ void foo() {
>  #pragma omp teams
>  #pragma omp distribute
>    for (int i = 0; i < 10; ++i) {
> -#pragma omp target
> +#pragma omp target // expected-error {{region cannot be nested inside
> 'target' region}}
>      ++a;
>    }
>  #pragma omp target
>  #pragma omp teams
>  #pragma omp distribute
>    for (int i = 0; i < 10; ++i) {
> -#pragma omp target parallel
> +#pragma omp target parallel // expected-error {{region cannot be nested
> inside 'target' region}}
>      ++a;
>    }
>  #pragma omp target
>  #pragma omp teams
>  #pragma omp distribute
>    for (int i = 0; i < 10; ++i) {
> -#pragma omp target enter data map(to: a)
> +#pragma omp target enter data map(to: a) // expected-error {{region
> cannot be nested inside 'target' region}}
>      ++a;
>    }
>  #pragma omp target
>  #pragma omp teams
>  #pragma omp distribute
>    for (int i = 0; i < 10; ++i) {
> -#pragma omp target exit data map(from: a)
> +#pragma omp target exit data map(from: a) // expected-error {{region
> cannot be nested inside 'target' region}}
>      ++a;
>    }
>  #pragma omp target
> @@ -5807,21 +5807,21 @@ void foo() {
>    }
>  #pragma omp target
>    {
> -#pragma omp target
> +#pragma omp target // expected-error {{region cannot be nested inside
> 'target' region}}
>      ++a;
>    }
>  #pragma omp target
>    {
> -#pragma omp target parallel
> +#pragma omp target parallel // expected-error {{region cannot be nested
> inside 'target' region}}
>      ++a;
>    }
>  #pragma omp target
>    {
> -#pragma omp target enter data map(to: a)
> +#pragma omp target enter data map(to: a) // expected-error {{region
> cannot be nested inside 'target' region}}
>    }
>  #pragma omp target
>    {
> -#pragma omp target exit data map(from: a)
> +#pragma omp target exit data map(from: a) // expected-error {{region
> cannot be nested inside 'target' region}}
>    }
>  #pragma omp target
>    {
> @@ -5937,12 +5937,12 @@ void foo() {
>    }
>  #pragma omp target parallel
>    {
> -#pragma omp target
> +#pragma omp target // expected-error {{region cannot be nested inside
> 'target parallel' region}}
>      ++a;
>    }
>  #pragma omp target parallel
>    {
> -#pragma omp target parallel
> +#pragma omp target parallel // expected-error {{region cannot be nested
> inside 'target parallel' region}}
>      ++a;
>    }
>  #pragma omp target parallel
> @@ -5970,11 +5970,11 @@ void foo() {
>    }
>  #pragma omp target parallel
>    {
> -#pragma omp target enter data map(to: a)
> +#pragma omp target enter data map(to: a) // expected-error {{region
> cannot be nested inside 'target parallel' region}}
>    }
>  #pragma omp target parallel
>    {
> -#pragma omp target exit data map(from: a)
> +#pragma omp target exit data map(from: a) // expected-error {{region
> cannot be nested inside 'target parallel' region}}
>    }
>
>  // TEAMS DIRECTIVE
> @@ -6093,7 +6093,7 @@ void foo() {
>  #pragma omp target
>  #pragma omp teams
>    {
> -#pragma omp target parallel
> +#pragma omp target parallel // expected-error {{region cannot be nested
> inside 'target' region}}
>      ++a;
>    }
>  #pragma omp target
> @@ -6477,14 +6477,14 @@ void foo() {
>  #pragma omp teams
>  #pragma omp distribute
>    for (int i = 0; i < 10; ++i) {
> -#pragma omp target
> +#pragma omp target // expected-error {{region cannot be nested inside
> 'target' region}}
>      ++a;
>    }
>  #pragma omp target
>  #pragma omp teams
>  #pragma omp distribute
>    for (int i = 0; i < 10; ++i) {
> -#pragma omp target parallel
> +#pragma omp target parallel // expected-error {{region cannot be nested
> inside 'target' region}}
>      ++a;
>    }
>  #pragma omp target
> @@ -6499,14 +6499,14 @@ void foo() {
>  #pragma omp teams
>  #pragma omp distribute
>    for (int i = 0; i < 10; ++i) {
> -#pragma omp target enter data map(to: a)
> +#pragma omp target enter data map(to: a) // expected-error {{region
> cannot be nested inside 'target' region}}
>      ++a;
>    }
>  #pragma omp target
>  #pragma omp teams
>  #pragma omp distribute
>    for (int i = 0; i < 10; ++i) {
> -#pragma omp target exit data map(from: a)
> +#pragma omp target exit data map(from: a) // expected-error {{region
> cannot be nested inside 'target' region}}
>      ++a;
>    }
>  }
>
> Modified: cfe/trunk/test/OpenMP/target_data_device_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_data_device_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_data_device_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_data_device_messages.cpp Mon Feb  1
> 10:32:47 2016
> @@ -21,8 +21,8 @@ int main(int argc, char **argv) {
>    #pragma omp target data map(to: a) device (argc), device (argc+1) //
> expected-error {{directive '#pragma omp target data' cannot contain more
> than one 'device' clause}}
>    #pragma omp target data map(to: a) device (S1) // expected-error {{'S1'
> does not refer to a value}}
>    #pragma omp target data map(to: a) device (-2) // expected-error
> {{argument to 'device' clause must be a non-negative integer value}}
> -  #pragma omp target map(to: a) device (-10u)
> -  #pragma omp target map(to: a) device (3.14) // expected-error
> {{expression must have integral or unscoped enumeration type, not 'double'}}
> +  #pragma omp target data map(to: a) device (-10u)
> +  #pragma omp target data map(to: a) device (3.14) // expected-error
> {{expression must have integral or unscoped enumeration type, not 'double'}}
>    foo();
>
>    return 0;
>
> Modified: cfe/trunk/test/OpenMP/target_device_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_device_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_device_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_device_messages.cpp Mon Feb  1 10:32:47
> 2016
> @@ -11,16 +11,27 @@ struct S1; // expected-note {{declared h
>
>  int main(int argc, char **argv) {
>    #pragma omp target device // expected-error {{expected '(' after
> 'device'}}
> +  foo();
>    #pragma omp target device ( // expected-error {{expected expression}}
> expected-error {{expected ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target device () // expected-error {{expected expression}}
> +  foo();
>    #pragma omp target device (argc // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target device (argc)) // expected-warning {{extra tokens at
> the end of '#pragma omp target' are ignored}}
> -#pragma omp target device (argc > 0 ? argv[1] : argv[2]) //
> expected-error {{expression must have integral or unscoped enumeration
> type, not 'char *'}}
> +  foo();
> +  #pragma omp target device (argc > 0 ? argv[1] : argv[2]) //
> expected-error {{expression must have integral or unscoped enumeration
> type, not 'char *'}}
> +  foo();
>    #pragma omp target device (argc + argc)
> +  foo();
>    #pragma omp target device (argc), device (argc+1) // expected-error
> {{directive '#pragma omp target' cannot contain more than one 'device'
> clause}}
> +  foo();
>    #pragma omp target device (S1) // expected-error {{'S1' does not refer
> to a value}}
> +  foo();
>    #pragma omp target device (-2) // expected-error {{argument to 'device'
> clause must be a non-negative integer value}}
> +  foo();
>    #pragma omp target device (-10u)
> +  foo();
>    #pragma omp target device (3.14) // expected-error {{expression must
> have integral or unscoped enumeration type, not 'double'}}
>    foo();
>
>
> Modified: cfe/trunk/test/OpenMP/target_if_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_if_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_if_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_if_messages.cpp Mon Feb  1 10:32:47 2016
> @@ -12,21 +12,37 @@ struct S1; // expected-note {{declared h
>  template <class T, class S> // expected-note {{declared here}}
>  int tmain(T argc, S **argv) {
>    #pragma omp target if // expected-error {{expected '(' after 'if'}}
> +  foo();
>    #pragma omp target if ( // expected-error {{expected expression}}
> expected-error {{expected ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target if () // expected-error {{expected expression}}
> +  foo();
>    #pragma omp target if (argc // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target if (argc)) // expected-warning {{extra tokens at the
> end of '#pragma omp target' are ignored}}
> +  foo();
>    #pragma omp target if (argc > 0 ? argv[1] : argv[2])
> +  foo();
>    #pragma omp target if (foobool(argc)), if (true) // expected-error
> {{directive '#pragma omp target' cannot contain more than one 'if' clause}}
> +  foo();
>    #pragma omp target if (S) // expected-error {{'S' does not refer to a
> value}}
> +  foo();
>    #pragma omp target if (argv[1]=2) // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target if (argc argc) // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target if(argc)
> +  foo();
>    #pragma omp target if(target : // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target if(target : argc // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target if(target : argc)
> +  foo();
>    #pragma omp target if(target : argc) if (for:argc) // expected-error
> {{directive name modifier 'for' is not allowed for '#pragma omp target'}}
> +  foo();
>    #pragma omp target if(target : argc) if (target:argc) // expected-error
> {{directive '#pragma omp target' cannot contain more than one 'if' clause
> with 'target' name modifier}}
> +  foo();
>    #pragma omp target if(target : argc) if (argc) // expected-error {{no
> more 'if' clause is allowed}} expected-note {{previous clause with
> directive name modifier specified here}}
>    foo();
>
> @@ -35,22 +51,39 @@ int tmain(T argc, S **argv) {
>
>  int main(int argc, char **argv) {
>    #pragma omp target if // expected-error {{expected '(' after 'if'}}
> +  foo();
>    #pragma omp target if ( // expected-error {{expected expression}}
> expected-error {{expected ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target if () // expected-error {{expected expression}}
> +  foo();
>    #pragma omp target if (argc // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target if (argc)) // expected-warning {{extra tokens at the
> end of '#pragma omp target' are ignored}}
> +  foo();
>    #pragma omp target if (argc > 0 ? argv[1] : argv[2])
> +  foo();
>    #pragma omp target if (foobool(argc)), if (true) // expected-error
> {{directive '#pragma omp target' cannot contain more than one 'if' clause}}
> +  foo();
>    #pragma omp target if (S1) // expected-error {{'S1' does not refer to a
> value}}
> +  foo();
>    #pragma omp target if (argv[1]=2) // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target if (argc argc) // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target if (1 0) // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target if(if(tmain(argc, argv) // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target if(target : // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target if(target : argc // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target if(target : argc)
> +  foo();
>    #pragma omp target if(target : argc) if (for:argc) // expected-error
> {{directive name modifier 'for' is not allowed for '#pragma omp target'}}
> +  foo();
>    #pragma omp target if(target : argc) if (target:argc) // expected-error
> {{directive '#pragma omp target' cannot contain more than one 'if' clause
> with 'target' name modifier}}
> +  foo();
>    #pragma omp target if(target : argc) if (argc) // expected-error {{no
> more 'if' clause is allowed}} expected-note {{previous clause with
> directive name modifier specified here}}
>    foo();
>
>
> Modified: cfe/trunk/test/OpenMP/target_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_messages.cpp Mon Feb  1 10:32:47 2016
> @@ -21,6 +21,7 @@ int main(int argc, char **argv) {
>    #pragma omp target } // expected-warning {{extra tokens at the end of
> '#pragma omp target' are ignored}}
>    foo();
>    #pragma omp target
> +  foo();
>    // expected-warning at +1 {{extra tokens at the end of '#pragma omp
> target' are ignored}}
>    #pragma omp target unknown()
>    foo();
>
> Modified: cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp Mon Feb  1
> 10:32:47 2016
> @@ -4,10 +4,15 @@ void foo();
>
>  int main(int argc, char **argv) {
>    #pragma omp target parallel default // expected-error {{expected '('
> after 'default'}}
> +  foo();
>    #pragma omp target parallel default ( // expected-error {{expected
> 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel default () // expected-error {{expected
> 'none' or 'shared' in OpenMP clause 'default'}}
> +  foo();
>    #pragma omp target parallel default (none // expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel default (shared), default(shared) //
> expected-error {{directive '#pragma omp target parallel' cannot contain
> more than one 'default' clause}}
> +  foo();
>    #pragma omp target parallel default (x) // expected-error {{expected
> 'none' or 'shared' in OpenMP clause 'default'}}
>    foo();
>
> @@ -15,6 +20,7 @@ int main(int argc, char **argv) {
>    ++argc; // expected-error {{variable 'argc' must have explicitly
> specified data sharing attributes}}
>
>    #pragma omp target parallel default(none)
> +  foo();
>    #pragma omp target parallel default(shared)
>    ++argc;
>    return 0;
>
> Modified: cfe/trunk/test/OpenMP/target_parallel_device_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_device_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_parallel_device_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_parallel_device_messages.cpp Mon Feb  1
> 10:32:47 2016
> @@ -11,16 +11,27 @@ struct S1; // expected-note {{declared h
>
>  int main(int argc, char **argv) {
>    #pragma omp target parallel device // expected-error {{expected '('
> after 'device'}}
> +  foo();
>    #pragma omp target parallel device ( // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target parallel device () // expected-error {{expected
> expression}}
> +  foo();
>    #pragma omp target parallel device (argc // expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel device (argc)) // expected-warning {{extra
> tokens at the end of '#pragma omp target parallel' are ignored}}
> -#pragma omp target parallel device (argc > 0 ? argv[1] : argv[2]) //
> expected-error {{expression must have integral or unscoped enumeration
> type, not 'char *'}}
> +  foo();
> +  #pragma omp target parallel device (argc > 0 ? argv[1] : argv[2]) //
> expected-error {{expression must have integral or unscoped enumeration
> type, not 'char *'}}
> +  foo();
>    #pragma omp target parallel device (argc + argc)
> +  foo();
>    #pragma omp target parallel device (argc), device (argc+1) //
> expected-error {{directive '#pragma omp target parallel' cannot contain
> more than one 'device' clause}}
> +  foo();
>    #pragma omp target parallel device (S1) // expected-error {{'S1' does
> not refer to a value}}
> +  foo();
>    #pragma omp target parallel device (-2) // expected-error {{argument to
> 'device' clause must be a non-negative integer value}}
> +  foo();
>    #pragma omp target parallel device (-10u)
> +  foo();
>    #pragma omp target parallel device (3.14) // expected-error
> {{expression must have integral or unscoped enumeration type, not 'double'}}
>    foo();
>
>
> Modified: cfe/trunk/test/OpenMP/target_parallel_firstprivate_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_firstprivate_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_parallel_firstprivate_messages.cpp
> (original)
> +++ cfe/trunk/test/OpenMP/target_parallel_firstprivate_messages.cpp Mon
> Feb  1 10:32:47 2016
> @@ -64,27 +64,47 @@ int main(int argc, char **argv) {
>    int &j = i;
>    static int m;
>    #pragma omp target parallel firstprivate // expected-error {{expected
> '(' after 'firstprivate'}}
> +  foo();
>    #pragma omp target parallel firstprivate ( // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target parallel firstprivate () // expected-error
> {{expected expression}}
> +  foo();
>    #pragma omp target parallel firstprivate (argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel firstprivate (argc, // expected-error
> {{expected expression}} expected-error {{expected ')'}} expected-note {{to
> match this '('}}
> +  foo();
>    #pragma omp target parallel firstprivate (argc > 0 ? argv[1] : argv[2])
> // expected-error {{expected variable name}}
> +  foo();
>    #pragma omp target parallel firstprivate (argc)
> +  foo();
>    #pragma omp target parallel firstprivate (S1) // expected-error {{'S1'
> does not refer to a value}}
> +  foo();
>    #pragma omp target parallel firstprivate (a, b, c, d, f) //
> expected-error {{firstprivate variable with incomplete type 'S1'}}
> +  foo();
>    #pragma omp target parallel firstprivate (argv[1]) // expected-error
> {{expected variable name}}
> +  foo();
>    #pragma omp target parallel firstprivate(ba)
> +  foo();
>    #pragma omp target parallel firstprivate(ca)
> +  foo();
>    #pragma omp target parallel firstprivate(da)
> +  foo();
>    #pragma omp target parallel firstprivate(S2::S2s)
> +  foo();
>    #pragma omp target parallel firstprivate(S2::S2sc)
> +  foo();
>    #pragma omp target parallel firstprivate(e, g) // expected-error
> {{calling a private constructor of class 'S4'}} expected-error {{calling a
> private constructor of class 'S5'}}
> +  foo();
>    #pragma omp target parallel firstprivate(h, B::x) // expected-error 2
> {{threadprivate or thread local variable cannot be firstprivate}}
> +  foo();
>    #pragma omp target parallel private(i), firstprivate(i) //
> expected-error {{private variable cannot be firstprivate}}
> expected-note{{defined as private}}
>    foo();
>    #pragma omp target parallel shared(i)
> +  foo();
>    #pragma omp target parallel firstprivate(i)
> +  foo();
>    #pragma omp target parallel firstprivate(j)
> +  foo();
>    #pragma omp target parallel firstprivate(m)
>    foo();
>
>
> Modified: cfe/trunk/test/OpenMP/target_parallel_if_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_if_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_parallel_if_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_parallel_if_messages.cpp Mon Feb  1
> 10:32:47 2016
> @@ -12,25 +12,45 @@ struct S1; // expected-note {{declared h
>  template <class T, class S> // expected-note {{declared here}}
>  int tmain(T argc, S **argv) {
>    #pragma omp target parallel if // expected-error {{expected '(' after
> 'if'}}
> +  foo();
>    #pragma omp target parallel if ( // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target parallel if () // expected-error {{expected
> expression}}
> +  foo();
>    #pragma omp target parallel if (argc // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel if (argc)) // expected-warning {{extra
> tokens at the end of '#pragma omp target parallel' are ignored}}
> +  foo();
>    #pragma omp target parallel if (argc > 0 ? argv[1] : argv[2])
> +  foo();
>    #pragma omp target parallel if (foobool(argc)), if (true) //
> expected-error {{directive '#pragma omp target parallel' cannot contain
> more than one 'if' clause}}
> +  foo();
>    #pragma omp target parallel if (S) // expected-error {{'S' does not
> refer to a value}}
> +  foo();
>    #pragma omp target parallel if (argv[1]=2) // expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel if (argc argc) // expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel if(argc)
> +  foo();
>    #pragma omp target parallel if(target : // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target parallel if(parallel : argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel if(target : argc)
> +  foo();
>    #pragma omp target parallel if(parallel : argc)
> +  foo();
>    #pragma omp target parallel if(target : argc) if(parallel : argc)
> +  foo();
>    #pragma omp target parallel if(parallel : argc) if (for:argc) //
> expected-error {{directive name modifier 'for' is not allowed for '#pragma
> omp target parallel'}}
> +  foo();
>    #pragma omp target parallel if(target : argc) if (target :argc) //
> expected-error {{directive '#pragma omp target parallel' cannot contain
> more than one 'if' clause with 'target' name modifier}}
> +  foo();
>    #pragma omp target parallel if(parallel : argc) if (parallel :argc) //
> expected-error {{directive '#pragma omp target parallel' cannot contain
> more than one 'if' clause with 'parallel' name modifier}}
> +  foo();
>    #pragma omp target parallel if(target : argc) if (argc) //
> expected-error {{expected  'parallel' directive name modifier}}
> expected-note {{previous clause with directive name modifier specified
> here}}
> +  foo();
>    #pragma omp target parallel if(target : argc) if(parallel : argc) if
> (argc) // expected-error {{no more 'if' clause is allowed}} expected-note
> {{previous clause with directive name modifier specified here}}
> expected-note {{previous clause with directive name modifier specified
> here}}
>    foo();
>
> @@ -39,24 +59,43 @@ int tmain(T argc, S **argv) {
>
>  int main(int argc, char **argv) {
>    #pragma omp target parallel if // expected-error {{expected '(' after
> 'if'}}
> +  foo();
>    #pragma omp target parallel if ( // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target parallel if () // expected-error {{expected
> expression}}
> +  foo();
>    #pragma omp target parallel if (argc // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel if (argc)) // expected-warning {{extra
> tokens at the end of '#pragma omp target parallel' are ignored}}
> +  foo();
>    #pragma omp target parallel if (argc > 0 ? argv[1] : argv[2])
> +  foo();
>    #pragma omp target parallel if (foobool(argc)), if (true) //
> expected-error {{directive '#pragma omp target parallel' cannot contain
> more than one 'if' clause}}
> +  foo();
>    #pragma omp target parallel if (S1) // expected-error {{'S1' does not
> refer to a value}}
> +  foo();
>    #pragma omp target parallel if (argv[1]=2) // expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel if (argc argc) // expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel if (1 0) // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel if(if(tmain(argc, argv) // expected-error
> {{expected expression}} expected-error {{expected ')'}} expected-note {{to
> match this '('}}
> +  foo();
>    #pragma omp target parallel if(target : // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target parallel if(parallel : argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel if(parallel : argc)
> +  foo();
>    #pragma omp target parallel if(target : argc) if (for:argc) //
> expected-error {{directive name modifier 'for' is not allowed for '#pragma
> omp target parallel'}}
> +  foo();
>    #pragma omp target parallel if(target : argc) if (target :argc) //
> expected-error {{directive '#pragma omp target parallel' cannot contain
> more than one 'if' clause with 'target' name modifier}}
> +  foo();
>    #pragma omp target parallel if(parallel : argc) if (parallel :argc) //
> expected-error {{directive '#pragma omp target parallel' cannot contain
> more than one 'if' clause with 'parallel' name modifier}}
> +  foo();
>    #pragma omp target parallel if(target : argc) if (argc) //
> expected-error {{expected  'parallel' directive name modifier}}
> expected-note {{previous clause with directive name modifier specified
> here}}
> +  foo();
>    #pragma omp target parallel if(target : argc) if(parallel : argc) if
> (argc) // expected-error {{no more 'if' clause is allowed}} expected-note
> {{previous clause with directive name modifier specified here}}
> expected-note {{previous clause with directive name modifier specified
> here}}
>    foo();
>
>
> Modified: cfe/trunk/test/OpenMP/target_parallel_map_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_map_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_parallel_map_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_parallel_map_messages.cpp Mon Feb  1
> 10:32:47 2016
> @@ -65,13 +65,21 @@ T tmain(T argc) {
>
>
>  #pragma omp target parallel map // expected-error {{expected '(' after
> 'map'}}
> +  foo();
>  #pragma omp target parallel map( // expected-error {{expected ')'}}
> expected-note {{to match this '('}} expected-error {{expected expression}}
> +  foo();
>  #pragma omp target parallel map() // expected-error {{expected
> expression}}
> +  foo();
>  #pragma omp target parallel map(alloc) // expected-error {{use of
> undeclared identifier 'alloc'}}
> +  foo();
>  #pragma omp target parallel map(to argc // expected-error {{expected
> ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or
> ')' in 'map' clause}}
> +  foo();
>  #pragma omp target parallel map(to:) // expected-error {{expected
> expression}}
> +  foo();
>  #pragma omp target parallel map(from: argc, // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>  #pragma omp target parallel map(x: y) // expected-error {{incorrect map
> type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or
> 'delete'}}
> +  foo();
>  #pragma omp target parallel map(x)
>    foo();
>  #pragma omp target parallel map(tofrom: t[:I])
> @@ -97,38 +105,62 @@ T tmain(T argc) {
>  #pragma omp target parallel map(to, x)
>    foo();
>  #pragma omp target parallel map(to x) // expected-error {{expected ',' or
> ')' in 'map' clause}}
> +  foo();
>  #pragma omp target parallel map(tofrom: argc > 0 ? x : y) //
> expected-error 2 {{expected expression containing only member accesses
> and/or array sections based on named variables}}
> +  foo();
>  #pragma omp target parallel map(argc)
> +  foo();
>  #pragma omp target parallel map(S1) // expected-error {{'S1' does not
> refer to a value}}
> +  foo();
>  #pragma omp target parallel map(a, b, c, d, f) // expected-error
> {{incomplete type 'S1' where a complete type is required}} expected-error 2
> {{type 'S2' is not mappable to target}}
> +  foo();
>  #pragma omp target parallel map(ba) // expected-error 2 {{type 'S2' is
> not mappable to target}}
> +  foo();
>  #pragma omp target parallel map(ca)
> +  foo();
>  #pragma omp target parallel map(da)
> +  foo();
>  #pragma omp target parallel map(S2::S2s)
> +  foo();
>  #pragma omp target parallel map(S2::S2sc)
> +  foo();
>  #pragma omp target parallel map(e, g)
> +  foo();
>  #pragma omp target parallel map(h) // expected-error {{threadprivate
> variables are not allowed in map clause}}
> +  foo();
>  #pragma omp target parallel map(k), map(k) // expected-error 2 {{variable
> already marked as mapped in current construct}} expected-note 2 {{used
> here}}
> +  foo();
>  #pragma omp target parallel map(k), map(k[:5]) // expected-error 2
> {{pointer cannot be mapped along with a section derived from itself}}
> expected-note 2 {{used here}}
>    foo();
>  #pragma omp target parallel map(da)
> +  foo();
>  #pragma omp target parallel map(da[:4])
>    foo();
> -#pragma omp target parallel map(k, j, l) // expected-note 2 {{used here}}
> +#pragma omp target data map(k, j, l) // expected-note 2 {{used here}}
>  #pragma omp target parallel map(k[:4]) // expected-error 2 {{pointer
> cannot be mapped along with a section derived from itself}}
> +  foo();
>  #pragma omp target parallel map(j)
> +  foo();
>  #pragma omp target parallel map(l) map(l[:5]) // expected-error 2
> {{variable already marked as mapped in current construct}} expected-note 2
> {{used here}}
>    foo();
> -#pragma omp target parallel map(k[:4], j, l[:5]) // expected-note 4
> {{used here}}
> +#pragma omp target data map(k[:4], j, l[:5]) // expected-note 4 {{used
> here}}
> +{
>  #pragma omp target parallel map(k) // expected-error 2 {{pointer cannot
> be mapped along with a section derived from itself}}
> +  foo();
>  #pragma omp target parallel map(j)
> +  foo();
>  #pragma omp target parallel map(l) // expected-error 2 {{original storage
> of expression in data environment is shared but data environment do not
> fully contain mapped expression storage}}
>    foo();
> +}
>
>  #pragma omp target parallel map(always, tofrom: x)
> +  foo();
>  #pragma omp target parallel map(always: x) // expected-error {{missing
> map type}}
> +  foo();
>  #pragma omp target parallel map(tofrom, always: x) // expected-error
> {{incorrect map type modifier, expected 'always'}} expected-error
> {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc',
> 'release', or 'delete'}}
> +  foo();
>  #pragma omp target parallel map(always, tofrom: always, tofrom, x)
> +  foo();
>  #pragma omp target parallel map(tofrom j) // expected-error {{expected
> ',' or ')' in 'map' clause}}
>    foo();
>
> @@ -148,13 +180,21 @@ int main(int argc, char **argv) {
>    int to, tofrom, always;
>    const int (&l)[5] = da;
>  #pragma omp target parallel map // expected-error {{expected '(' after
> 'map'}}
> +  foo();
>  #pragma omp target parallel map( // expected-error {{expected ')'}}
> expected-note {{to match this '('}} expected-error {{expected expression}}
> +  foo();
>  #pragma omp target parallel map() // expected-error {{expected
> expression}}
> +  foo();
>  #pragma omp target parallel map(alloc) // expected-error {{use of
> undeclared identifier 'alloc'}}
> +  foo();
>  #pragma omp target parallel map(to argc // expected-error {{expected
> ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or
> ')' in 'map' clause}}
> +  foo();
>  #pragma omp target parallel map(to:) // expected-error {{expected
> expression}}
> +  foo();
>  #pragma omp target parallel map(from: argc, // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>  #pragma omp target parallel map(x: y) // expected-error {{incorrect map
> type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or
> 'delete'}}
> +  foo();
>  #pragma omp target parallel map(x)
>    foo();
>  #pragma omp target parallel map(to: x)
> @@ -166,39 +206,64 @@ int main(int argc, char **argv) {
>  #pragma omp target parallel map(to, x)
>    foo();
>  #pragma omp target parallel map(to x) // expected-error {{expected ',' or
> ')' in 'map' clause}}
> +  foo();
>  #pragma omp target parallel map(tofrom: argc > 0 ? argv[1] : argv[2]) //
> expected-error {{expected expression containing only member accesses and/or
> array sections based on named variables}}
> +  foo();
>  #pragma omp target parallel map(argc)
> +  foo();
>  #pragma omp target parallel map(S1) // expected-error {{'S1' does not
> refer to a value}}
> +  foo();
>  #pragma omp target parallel map(a, b, c, d, f) // expected-error
> {{incomplete type 'S1' where a complete type is required}} expected-error 2
> {{type 'S2' is not mappable to target}}
> +  foo();
>  #pragma omp target parallel map(argv[1])
> +  foo();
>  #pragma omp target parallel map(ba) // expected-error 2 {{type 'S2' is
> not mappable to target}}
> +  foo();
>  #pragma omp target parallel map(ca)
> +  foo();
>  #pragma omp target parallel map(da)
> +  foo();
>  #pragma omp target parallel map(S2::S2s)
> +  foo();
>  #pragma omp target parallel map(S2::S2sc)
> +  foo();
>  #pragma omp target parallel map(e, g)
> +  foo();
>  #pragma omp target parallel map(h) // expected-error {{threadprivate
> variables are not allowed in map clause}}
> +  foo();
>  #pragma omp target parallel map(k), map(k) // expected-error {{variable
> already marked as mapped in current construct}} expected-note {{used here}}
> +  foo();
>  #pragma omp target parallel map(k), map(k[:5]) // expected-error
> {{pointer cannot be mapped along with a section derived from itself}}
> expected-note {{used here}}
>    foo();
>  #pragma omp target parallel map(da)
> +  foo();
>  #pragma omp target parallel map(da[:4])
>    foo();
> -#pragma omp target parallel map(k, j, l) // expected-note {{used here}}
> +#pragma omp target data map(k, j, l) // expected-note {{used here}}
>  #pragma omp target parallel map(k[:4]) // expected-error {{pointer cannot
> be mapped along with a section derived from itself}}
> +  foo();
>  #pragma omp target parallel map(j)
> +  foo();
>  #pragma omp target parallel map(l) map(l[:5]) // expected-error 1
> {{variable already marked as mapped in current construct}} expected-note 1
> {{used here}}
>    foo();
> -#pragma omp target parallel map(k[:4], j, l[:5]) // expected-note 2
> {{used here}}
> +#pragma omp target data map(k[:4], j, l[:5]) // expected-note 2 {{used
> here}}
> +{
>  #pragma omp target parallel map(k) // expected-error {{pointer cannot be
> mapped along with a section derived from itself}}
> +  foo();
>  #pragma omp target parallel map(j)
> +  foo();
>  #pragma omp target parallel map(l) // expected-error {{original storage
> of expression in data environment is shared but data environment do not
> fully contain mapped expression storage}}
>    foo();
> +}
>
>  #pragma omp target parallel map(always, tofrom: x)
> +  foo();
>  #pragma omp target parallel map(always: x) // expected-error {{missing
> map type}}
> +  foo();
>  #pragma omp target parallel map(tofrom, always: x) // expected-error
> {{incorrect map type modifier, expected 'always'}} expected-error
> {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc',
> 'release', or 'delete'}}
> +  foo();
>  #pragma omp target parallel map(always, tofrom: always, tofrom, x)
> +  foo();
>  #pragma omp target parallel map(tofrom j) // expected-error {{expected
> ',' or ')' in 'map' clause}}
>    foo();
>
>
> Modified: cfe/trunk/test/OpenMP/target_parallel_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_parallel_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_parallel_messages.cpp Mon Feb  1 10:32:47
> 2016
> @@ -24,6 +24,7 @@ int main(int argc, char **argv) {
>    #pragma omp target parallel } // expected-warning {{extra tokens at the
> end of '#pragma omp target parallel' are ignored}}
>    foo();
>    #pragma omp target parallel
> +  foo();
>    // expected-warning at +1 {{extra tokens at the end of '#pragma omp
> target parallel' are ignored}}
>    #pragma omp target parallel unknown()
>    foo();
>
> Modified: cfe/trunk/test/OpenMP/target_parallel_num_threads_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_num_threads_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_parallel_num_threads_messages.cpp
> (original)
> +++ cfe/trunk/test/OpenMP/target_parallel_num_threads_messages.cpp Mon
> Feb  1 10:32:47 2016
> @@ -14,16 +14,27 @@ struct S1; // expected-note {{declared h
>  template <class T, typename S, int N> // expected-note {{declared here}}
>  T tmain(T argc, S **argv) {
>    #pragma omp target parallel num_threads // expected-error {{expected
> '(' after 'num_threads'}}
> +  foo();
>    #pragma omp target parallel num_threads ( // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target parallel num_threads () // expected-error {{expected
> expression}}
> +  foo();
>    #pragma omp target parallel num_threads (argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel num_threads (argc)) // expected-warning
> {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
> +  foo();
>    #pragma omp target parallel num_threads ((argc > 0) ? argv[1] :
> argv[2]) // expected-error 2 {{expression must have integral or unscoped
> enumeration type, not 'char *'}}
> +  foo();
>    #pragma omp target parallel num_threads (foobool(argc)), num_threads
> (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp
> target parallel' cannot contain more than one 'num_threads' clause}}
> expected-error {{argument to 'num_threads' clause must be a strictly
> positive integer value}}
> +  foo();
>    #pragma omp target parallel num_threads (S) // expected-error {{'S'
> does not refer to a value}}
> +  foo();
>    #pragma omp target parallel num_threads (argv[1]=2) // expected-error
> {{expected ')'}} expected-note {{to match this '('}} expected-error 2
> {{expression must have integral or unscoped enumeration type, not 'char *'}}
> +  foo();
>    #pragma omp target parallel num_threads (argc)
> +  foo();
>    #pragma omp target parallel num_threads (N) // expected-error
> {{argument to 'num_threads' clause must be a strictly positive integer
> value}}
> +  foo();
>    #pragma omp target parallel redef_num_threads (argc, argc)
>    foo();
>
> @@ -32,15 +43,25 @@ T tmain(T argc, S **argv) {
>
>  int main(int argc, char **argv) {
>    #pragma omp target parallel num_threads // expected-error {{expected
> '(' after 'num_threads'}}
> +  foo();
>    #pragma omp target parallel num_threads ( // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target parallel num_threads () // expected-error {{expected
> expression}}
> +  foo();
>    #pragma omp target parallel num_threads (argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel num_threads (argc)) // expected-warning
> {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
> +  foo();
>    #pragma omp target parallel num_threads (argc > 0 ? argv[1] : argv[2])
> // expected-error {{integral }}
> +  foo();
>    #pragma omp target parallel num_threads (foobool(argc)), num_threads
> (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp
> target parallel' cannot contain more than one 'num_threads' clause}}
> expected-error {{argument to 'num_threads' clause must be a strictly
> positive integer value}}
> +  foo();
>    #pragma omp target parallel num_threads (S1) // expected-error {{'S1'
> does not refer to a value}}
> +  foo();
>    #pragma omp target parallel num_threads (argv[1]=2) // expected-error
> {{expected ')'}} expected-note {{to match this '('}} expected-error
> {{expression must have integral or unscoped enumeration type, not 'char *'}}
> +  foo();
>    #pragma omp target parallel num_threads (num_threads(tmain<int, char,
> -1>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to
> match this '('}} expected-note {{in instantiation of function template
> specialization 'tmain<int, char, -1>' requested here}}
> +  foo();
>    #pragma omp target parallel redef_num_threads (argc, argc)
>    foo();
>
>
> Modified: cfe/trunk/test/OpenMP/target_parallel_private_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_private_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_parallel_private_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_parallel_private_messages.cpp Mon Feb  1
> 10:32:47 2016
> @@ -61,28 +61,47 @@ int foomain(I argc, C **argv) {
>    I i;
>    I &j = i;
>  #pragma omp target parallel private // expected-error {{expected '('
> after 'private'}}
> +{}
>  #pragma omp target parallel private( // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +{}
>  #pragma omp target parallel private() // expected-error {{expected
> expression}}
> +{}
>  #pragma omp target parallel private(argc // expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> +{}
>  #pragma omp target parallel private(argc, // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +{}
>  #pragma omp target parallel private(argc > 0 ? argv[1] : argv[2]) //
> expected-error {{expected variable name}}
> +{}
>  #pragma omp target parallel private(argc argv) // expected-error
> {{expected ',' or ')' in 'private' clause}}
> +{}
>  #pragma omp target parallel private(argc)
> +{}
>  #pragma omp target parallel private(S1) // expected-error {{'S1' does not
> refer to a value}}
> +{}
>  #pragma omp target parallel private(a, b) // expected-error {{private
> variable with incomplete type 'S1'}}
> +{}
>  #pragma omp target parallel private (a, b, c, d, f) // expected-error {{a
> private variable with incomplete type 'S1'}} expected-error 3 {{shared
> variable cannot be private}}
> +{}
>  #pragma omp target parallel private(argv[1]) // expected-error {{expected
> variable name}}
> +{}
>  #pragma omp target parallel private(ba)
> +{}
>  #pragma omp target parallel private(ca) // expected-error {{shared
> variable cannot be private}}
> +{}
>  #pragma omp target parallel private(da) // expected-error {{shared
> variable cannot be private}}
> +{}
>  #pragma omp target parallel private(S2::S2s) // expected-error {{shared
> variable cannot be private}}
> +{}
>  #pragma omp target parallel private(e, g) // expected-error {{calling a
> private constructor of class 'S4'}} expected-error {{calling a private
> constructor of class 'S5'}}
> +{}
>    #pragma omp target parallel private(threadvar, B::x) // expected-error
> 2 {{threadprivate or thread local variable cannot be private}}
> +  {}
>    #pragma omp target parallel shared(i), private(i) // expected-error
> {{shared variable cannot be private}} expected-note {{defined as shared}}
>    foo();
>    #pragma omp target parallel firstprivate(i) private(i) //
> expected-error {{firstprivate variable cannot be private}} expected-note
> {{defined as firstprivate}}
>    foo();
>    #pragma omp target parallel private(i)
> +  {}
>    #pragma omp target parallel private(j)
>    foo();
>    #pragma omp parallel firstprivate(i)
> @@ -94,19 +113,21 @@ int foomain(I argc, C **argv) {
>    #pragma omp target parallel private(m) // OK
>    foo();
>  #pragma omp target parallel private(h) // expected-error {{threadprivate
> or thread local variable cannot be private}}
> +{}
>  #pragma omp target parallel private(B::x) // expected-error
> {{threadprivate or thread local variable cannot be private}}
>  #pragma omp parallel
>    {
>      int v = 0;
>      int i;
> -#pragma omp target parallel private(i)
> -    {}
>    }
>  #pragma omp target parallel shared(i)
> +{}
>  #pragma omp target parallel private(i)
> +{}
>  #pragma omp target parallel private(j)
> +{}
>  #pragma omp target parallel private(i)
> -  {}
> +{}
>    static int si;
>  #pragma omp target parallel private(si) // OK
>    {}
> @@ -127,28 +148,47 @@ int main(int argc, char **argv) {
>    int i;
>    int &j = i;
>  #pragma omp target parallel private // expected-error {{expected '('
> after 'private'}}
> +{}
>  #pragma omp target parallel private( // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +{}
>  #pragma omp target parallel private() // expected-error {{expected
> expression}}
> +{}
>  #pragma omp target parallel private(argc // expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> +{}
>  #pragma omp target parallel private(argc, // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +{}
>  #pragma omp target parallel private(argc > 0 ? argv[1] : argv[2]) //
> expected-error {{expected variable name}}
> +{}
>  #pragma omp target parallel private(argc argv) // expected-error
> {{expected ',' or ')' in 'private' clause}}
> +{}
>  #pragma omp target parallel private(argc)
> +{}
>  #pragma omp target parallel private(S1) // expected-error {{'S1' does not
> refer to a value}}
> +{}
>  #pragma omp target parallel private(a, b) // expected-error {{private
> variable with incomplete type 'S1'}}
> +{}
>  #pragma omp target parallel private (a, b, c, d, f) // expected-error {{a
> private variable with incomplete type 'S1'}} expected-error 3 {{shared
> variable cannot be private}}
> +{}
>  #pragma omp target parallel private(argv[1]) // expected-error {{expected
> variable name}}
> +{}
>  #pragma omp target parallel private(ba)
> +{}
>  #pragma omp target parallel private(ca) // expected-error {{shared
> variable cannot be private}}
> +{}
>  #pragma omp target parallel private(da) // expected-error {{shared
> variable cannot be private}}
> +{}
>  #pragma omp target parallel private(S2::S2s) // expected-error {{shared
> variable cannot be private}}
> +{}
>  #pragma omp target parallel private(e, g) // expected-error {{calling a
> private constructor of class 'S4'}} expected-error {{calling a private
> constructor of class 'S5'}}
> +{}
>    #pragma omp target parallel private(threadvar, B::x) // expected-error
> 2 {{threadprivate or thread local variable cannot be private}}
> +  {}
>    #pragma omp target parallel shared(i), private(i) // expected-error
> {{shared variable cannot be private}} expected-note {{defined as shared}}
>    foo();
>    #pragma omp target parallel firstprivate(i) private(i) //
> expected-error {{firstprivate variable cannot be private}} expected-note
> {{defined as firstprivate}}
>    foo();
>    #pragma omp target parallel private(i)
> +  {}
>    #pragma omp target parallel private(j)
>    foo();
>    #pragma omp parallel firstprivate(i)
> @@ -160,18 +200,20 @@ int main(int argc, char **argv) {
>    #pragma omp target parallel private(m) // OK
>    foo();
>  #pragma omp target parallel private(h) // expected-error {{threadprivate
> or thread local variable cannot be private}}
> +{}
>  #pragma omp target parallel private(B::x) // expected-error
> {{threadprivate or thread local variable cannot be private}}
>  #pragma omp parallel
>    {
>      int i;
> -#pragma omp target parallel private(i)
> -    {}
>    }
>  #pragma omp target parallel shared(i)
> +{}
>  #pragma omp target parallel private(i)
> +{}
>  #pragma omp target parallel private(j)
> +{}
>  #pragma omp target parallel private(i)
> -  {}
> +{}
>    static int si;
>  #pragma omp target parallel private(si) // OK
>    {}
>
> Modified: cfe/trunk/test/OpenMP/target_parallel_proc_bind_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_proc_bind_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_parallel_proc_bind_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_parallel_proc_bind_messages.cpp Mon Feb
> 1 10:32:47 2016
> @@ -4,10 +4,15 @@ void foo();
>
>  int main(int argc, char **argv) {
>    #pragma omp target parallel proc_bind // expected-error {{expected '('
> after 'proc_bind'}}
> +  foo();
>    #pragma omp target parallel proc_bind ( // expected-error {{expected
> 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel proc_bind () // expected-error {{expected
> 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}}
> +  foo();
>    #pragma omp target parallel proc_bind (master // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel proc_bind (close), proc_bind(spread) //
> expected-error {{directive '#pragma omp target parallel' cannot contain
> more than one 'proc_bind' clause}}
> +  foo();
>    #pragma omp target parallel proc_bind (x) // expected-error {{expected
> 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}}
>    foo();
>
> @@ -15,6 +20,7 @@ int main(int argc, char **argv) {
>    ++argc;
>
>    #pragma omp target parallel proc_bind(close)
> +  foo();
>    #pragma omp target parallel proc_bind(spread)
>    ++argc;
>    return 0;
>
> Modified: cfe/trunk/test/OpenMP/target_parallel_reduction_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_reduction_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_parallel_reduction_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_parallel_reduction_messages.cpp Mon Feb
> 1 10:32:47 2016
> @@ -131,7 +131,7 @@ T tmain(T argc) {
>    foo();
>  #pragma omp target parallel private(i), reduction(+ : j), reduction(+ :
> q) // expected-error 4 {{argument of OpenMP clause 'reduction' must
> reference the same object in all threads}}
>    foo();
> -#pragma omp target parallel private(k)
> +#pragma omp parallel private(k)
>  #pragma omp target parallel reduction(+ : p), reduction(+ : p) //
> expected-error 2 {{argument of OpenMP clause 'reduction' must reference the
> same object in all threads}}
>    foo();
>  #pragma omp target parallel reduction(+ : p), reduction(+ : p) //
> expected-error 3 {{variable can appear only once in OpenMP 'reduction'
> clause}} expected-note 3 {{previously referenced here}}
> @@ -139,17 +139,20 @@ T tmain(T argc) {
>  #pragma omp target parallel reduction(+ : r) // expected-error 2
> {{const-qualified list item cannot be reduction}}
>    foo();
>  #pragma omp target parallel shared(i)
> -#pragma omp target parallel reduction(min : i)
> +  foo();
> +#pragma omp parallel reduction(min : i)
>  #pragma omp target parallel reduction(max : j) // expected-error 2
> {{argument of OpenMP clause 'reduction' must reference the same object in
> all threads}}
>    foo();
>  #pragma omp target parallel
>  #pragma omp for private(fl)
>    for (int i = 0; i < 10; ++i)
> +  {}
>  #pragma omp target parallel reduction(+ : fl)
>      foo();
>  #pragma omp target parallel
>  #pragma omp for reduction(- : fl)
>    for (int i = 0; i < 10; ++i)
> +  {}
>  #pragma omp target parallel reduction(+ : fl)
>      foo();
>
> @@ -228,7 +231,7 @@ int main(int argc, char **argv) {
>    foo();
>  #pragma omp target parallel private(i), reduction(+ : j), reduction(+ :
> q) // expected-error 2 {{argument of OpenMP clause 'reduction' must
> reference the same object in all threads}}
>    foo();
> -#pragma omp target parallel private(k)
> +#pragma omp parallel private(k)
>  #pragma omp target parallel reduction(+ : p), reduction(+ : p) //
> expected-error 2 {{argument of OpenMP clause 'reduction' must reference the
> same object in all threads}}
>    foo();
>  #pragma omp target parallel reduction(+ : p), reduction(+ : p) //
> expected-error {{variable can appear only once in OpenMP 'reduction'
> clause}} expected-note {{previously referenced here}}
> @@ -236,17 +239,20 @@ int main(int argc, char **argv) {
>  #pragma omp target parallel reduction(+ : r) // expected-error
> {{const-qualified list item cannot be reduction}}
>    foo();
>  #pragma omp target parallel shared(i)
> -#pragma omp target parallel reduction(min : i)
> +  foo();
> +#pragma omp parallel reduction(min : i)
>  #pragma omp target parallel reduction(max : j) // expected-error
> {{argument of OpenMP clause 'reduction' must reference the same object in
> all threads}}
>    foo();
>  #pragma omp target parallel
>  #pragma omp for private(fl)
>    for (int i = 0; i < 10; ++i)
> +  {}
>  #pragma omp target parallel reduction(+ : fl)
>      foo();
>  #pragma omp target parallel
>  #pragma omp for reduction(- : fl)
>    for (int i = 0; i < 10; ++i)
> +  {}
>  #pragma omp target parallel reduction(+ : fl)
>      foo();
>    static int m;
>
> Modified: cfe/trunk/test/OpenMP/target_parallel_shared_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_shared_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_parallel_shared_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_parallel_shared_messages.cpp Mon Feb  1
> 10:32:47 2016
> @@ -60,30 +60,49 @@ int main(int argc, char **argv) {
>    int i;
>    int &j = i;
>    #pragma omp target parallel shared // expected-error {{expected '('
> after 'shared'}}
> +  foo();
>    #pragma omp target parallel shared ( // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target parallel shared () // expected-error {{expected
> expression}}
> +  foo();
>    #pragma omp target parallel shared (argc // expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> +  foo();
>    #pragma omp target parallel shared (argc, // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +  foo();
>    #pragma omp target parallel shared (argc > 0 ? argv[1] : argv[2]) //
> expected-error {{expected variable name}}
> +  foo();
>    #pragma omp target parallel shared (argc)
> +  foo();
>    #pragma omp target parallel shared (S1) // expected-error {{'S1' does
> not refer to a value}}
> +  foo();
>    #pragma omp target parallel shared (a, b, c, d, f)
> +  foo();
>    #pragma omp target parallel shared (argv[1]) // expected-error
> {{expected variable name}}
> +  foo();
>    #pragma omp target parallel shared(ba)
> +  foo();
>    #pragma omp target parallel shared(ca)
> +  foo();
>    #pragma omp target parallel shared(da)
> +  foo();
>    #pragma omp target parallel shared(e, g)
> +  foo();
>    #pragma omp target parallel shared(h, B::x) // expected-error 2
> {{threadprivate or thread local variable cannot be shared}}
> +  foo();
>    #pragma omp target parallel private(i), shared(i) // expected-error
> {{private variable cannot be shared}} expected-note {{defined as private}}
>    foo();
>    #pragma omp target parallel firstprivate(i), shared(i) //
> expected-error {{firstprivate variable cannot be shared}} expected-note
> {{defined as firstprivate}}
>    foo();
>    #pragma omp target parallel private(i)
> +  foo();
>    #pragma omp target parallel shared(i)
> +  foo();
>    #pragma omp target parallel shared(j)
>    foo();
>    #pragma omp target parallel firstprivate(i)
> +  foo();
>    #pragma omp target parallel shared(i)
> +  foo();
>    #pragma omp target parallel shared(j)
>    foo();
>
>
> Modified: cfe/trunk/test/OpenMP/target_private_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_private_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/target_private_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/target_private_messages.cpp Mon Feb  1 10:32:47
> 2016
> @@ -90,28 +90,39 @@ int foomain(I argc, C **argv) {
>    int i;
>    int &j = i;
>  #pragma omp target private // expected-error {{expected '(' after
> 'private'}}
> +{}
>  #pragma omp target private( // expected-error {{expected expression}}
> expected-error {{expected ')'}} expected-note {{to match this '('}}
> +{}
>  #pragma omp target private() // expected-error {{expected expression}}
> +{}
>  #pragma omp target private(argc // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +{}
>  #pragma omp target private(argc, // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +{}
>  #pragma omp target private(argc > 0 ? argv[1] : argv[2]) //
> expected-error {{expected variable name}}
> +{}
>  #pragma omp target private(argc)
> +{}
>  #pragma omp target private(S1) // expected-error {{'S1' does not refer to
> a value}}
> +{}
>  #pragma omp target private(a, b) // expected-error {{private variable
> with incomplete type 'S1'}}
> +{}
>  #pragma omp target private(argv[1]) // expected-error {{expected variable
> name}}
> +{}
>  #pragma omp target private(e, g)
> +{}
>  #pragma omp target private(h) // expected-error {{threadprivate or thread
> local variable cannot be private}}
> +{}
>  #pragma omp target shared(i) // expected-error {{unexpected OpenMP clause
> 'shared' in directive '#pragma omp target'}}
>  #pragma omp parallel
>    {
>      int v = 0;
>      int i;
> -#pragma omp target private(i)
> -    {}
>    }
>  #pragma omp parallel shared(i)
>  #pragma omp parallel private(i)
>  #pragma omp target private(j)
> +{}
>  #pragma omp target private(i)
>    {}
>    return 0;
> @@ -139,28 +150,40 @@ int main(int argc, char **argv) {
>    int i;
>    int &j = i;
>  #pragma omp target private // expected-error {{expected '(' after
> 'private'}}
> +{}
>  #pragma omp target private( // expected-error {{expected expression}}
> expected-error {{expected ')'}} expected-note {{to match this '('}}
> +{}
>  #pragma omp target private() // expected-error {{expected expression}}
> +{}
>  #pragma omp target private(argc // expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> +{}
>  #pragma omp target private(argc, // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to match this
> '('}}
> +{}
>  #pragma omp target private(argc > 0 ? argv[1] : argv[2]) //
> expected-error {{expected variable name}}
> +{}
>  #pragma omp target private(argc)
> +{}
>  #pragma omp target private(S1) // expected-error {{'S1' does not refer to
> a value}}
> +{}
>  #pragma omp target private(a, b) // expected-error {{private variable
> with incomplete type 'S1'}}
> +{}
>  #pragma omp target private(argv[1]) // expected-error {{expected variable
> name}}
> +{}
>  #pragma omp target private(e, g) // expected-error {{calling a private
> constructor of class 'S4'}} expected-error {{calling a private constructor
> of class 'S5'}}
> +{}
>  #pragma omp target private(h) // expected-error {{threadprivate or thread
> local variable cannot be private}}
> +{}
>  #pragma omp target private(B::x) // expected-error {{threadprivate or
> thread local variable cannot be private}}
> +{}
>  #pragma omp target shared(i) // expected-error {{unexpected OpenMP clause
> 'shared' in directive '#pragma omp target'}}
>  #pragma omp parallel
>    {
>      int i;
> -#pragma omp target private(i)
> -    {}
>    }
>  #pragma omp parallel shared(i)
>  #pragma omp parallel private(i)
>  #pragma omp target private(j)
> +{}
>  #pragma omp target private(i)
>    {}
>    static int si;
>
> Modified: cfe/trunk/test/OpenMP/teams_reduction_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_reduction_messages.cpp?rev=259366&r1=259365&r2=259366&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/OpenMP/teams_reduction_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/teams_reduction_messages.cpp Mon Feb  1 10:32:47
> 2016
> @@ -175,6 +175,7 @@ T tmain(T argc) {
>  #pragma omp teams
>  #pragma omp parallel for private(fl)
>    for (int i = 0; i < 10; ++i)
> +  {}
>  #pragma omp target
>  #pragma omp teams reduction(+ : fl)
>      foo();
> @@ -182,6 +183,7 @@ T tmain(T argc) {
>  #pragma omp teams
>  #pragma omp parallel for reduction(- : fl)
>    for (int i = 0; i < 10; ++i)
> +  {}
>  #pragma omp target
>  #pragma omp teams reduction(+ : fl)
>      foo();
> @@ -306,6 +308,7 @@ int main(int argc, char **argv) {
>  #pragma omp teams
>  #pragma omp parallel for private(fl)
>    for (int i = 0; i < 10; ++i)
> +  {}
>  #pragma omp target
>  #pragma omp teams reduction(+ : fl)
>      foo();
> @@ -313,6 +316,7 @@ int main(int argc, char **argv) {
>  #pragma omp teams
>  #pragma omp parallel for reduction(- : fl)
>    for (int i = 0; i < 10; ++i)
> +  {}
>  #pragma omp target
>  #pragma omp teams reduction(+ : fl)
>      foo();
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160201/aa9ec76a/attachment-0001.html>


More information about the cfe-commits mailing list