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
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);
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}}
VC object1;
g = object.method();
g += object.method1();
- g += object1.method();
+ g += object1.method() + p;
f();
c(); // expected-note {{used here}}
}
#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);
}