r331211 - [OPENMP] Do not emit warning about non-declared target function params.
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 30 11:28:08 PDT 2018
Author: abataev
Date: Mon Apr 30 11:28:08 2018
New Revision: 331211
URL: http://llvm.org/viewvc/llvm-project?rev=331211&view=rev
Log:
[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.
Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/declare_target_messages.cpp
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=331211&r1=331210&r2=331211&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Apr 30 11:28:08 2018
@@ -12962,7 +12962,7 @@ static void checkDeclInTargetContext(Sou
if (!LD)
LD = D;
if (LD && !LD->hasAttr<OMPDeclareTargetDeclAttr>() &&
- (isa<VarDecl>(LD) || isa<FunctionDecl>(LD))) {
+ ((isa<VarDecl>(LD) && !isa<ParmVarDecl>(LD)) || isa<FunctionDecl>(LD))) {
// Outlined declaration is not declared target.
if (LD->isOutOfLine()) {
SemaRef.Diag(LD->getLocation(), diag::warn_omp_not_in_target_context);
Modified: cfe/trunk/test/OpenMP/declare_target_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_target_messages.cpp?rev=331211&r1=331210&r2=331211&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/declare_target_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/declare_target_messages.cpp Mon Apr 30 11:28:08 2018
@@ -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);
}
More information about the cfe-commits
mailing list