From 3dcce36d78d75564cd188a029c56d5d69c1fc9c6 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Mon, 30 Apr 2018 18:28:08 +0000 Subject: [PATCH] [OPENMP] Do not emit warning about non-declared target function params. We should not emit warning that the parameters are not marked as declare target, these declaration are local and cannot be marked as declare target. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331211 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaOpenMP.cpp | 2 +- test/OpenMP/declare_target_messages.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 6220e86b54..896954fcf0 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -12962,7 +12962,7 @@ static void checkDeclInTargetContext(SourceLocation SL, SourceRange SR, if (!LD) LD = D; if (LD && !LD->hasAttr() && - (isa(LD) || isa(LD))) { + ((isa(LD) && !isa(LD)) || isa(LD))) { // Outlined declaration is not declared target. if (LD->isOutOfLine()) { SemaRef.Diag(LD->getLocation(), diag::warn_omp_not_in_target_context); diff --git a/test/OpenMP/declare_target_messages.cpp b/test/OpenMP/declare_target_messages.cpp index 3286a29dc4..72ea33cfc8 100644 --- a/test/OpenMP/declare_target_messages.cpp +++ b/test/OpenMP/declare_target_messages.cpp @@ -88,7 +88,7 @@ int C::method1() { return 0; } -void foo() { +void foo(int p) { a = 0; // expected-error {{threadprivate variables cannot be used in target constructs}} b = 0; // expected-note {{used here}} t = 1; // expected-error {{threadprivate variables cannot be used in target constructs}} @@ -96,7 +96,7 @@ void foo() { VC object1; g = object.method(); g += object.method1(); - g += object1.method(); + g += object1.method() + p; f(); c(); // expected-note {{used here}} } @@ -119,7 +119,7 @@ int main (int argc, char **argv) { #pragma omp declare target // expected-error {{unexpected OpenMP directive '#pragma omp declare target'}} int v; #pragma omp end declare target // expected-error {{unexpected OpenMP directive '#pragma omp end declare target'}} - foo(); + foo(v); return (0); } -- 2.40.0