[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.

llvm-svn: 331211
This commit is contained in:
Alexey Bataev 2018-04-30 18:28:08 +00:00
parent 1babf5ff32
commit d0df36a79a
2 changed files with 4 additions and 4 deletions

View File

@ -12962,7 +12962,7 @@ static void checkDeclInTargetContext(SourceLocation SL, SourceRange SR,
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);

View File

@ -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);
}