r211262 - [OPENMP] Improved diagnostic messages for vars with the predetermined data sharing attributes and reformatting
Alexey Bataev
a.bataev at hotmail.com
Thu Jun 19 02:13:46 PDT 2014
Author: abataev
Date: Thu Jun 19 04:13:45 2014
New Revision: 211262
URL: http://llvm.org/viewvc/llvm-project?rev=211262&view=rev
Log:
[OPENMP] Improved diagnostic messages for vars with the predetermined data sharing attributes and reformatting
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/for_ast_print.cpp
cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp
cfe/trunk/test/OpenMP/for_lastprivate_messages.cpp
cfe/trunk/test/OpenMP/for_private_messages.cpp
cfe/trunk/test/OpenMP/for_reduction_messages.cpp
cfe/trunk/test/OpenMP/no_option.c
cfe/trunk/test/OpenMP/no_option_no_warn.c
cfe/trunk/test/OpenMP/parallel_private_messages.cpp
cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp
cfe/trunk/test/OpenMP/simd_lastprivate_messages.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Jun 19 04:13:45 2014
@@ -6991,7 +6991,15 @@ def err_omp_wrong_dsa : Error<
def note_omp_explicit_dsa : Note<
"defined as %0">;
def note_omp_predetermined_dsa : Note<
- "predetermined as %0">;
+ "%select{static data member is predetermined as shared|"
+ "variable with static storage duration is predetermined as shared|"
+ "loop iteration variable is predetermined as private|"
+ "loop iteration variable is predetermined as linear|"
+ "loop iteration variable is predetermined as lastprivate|"
+ "constant variable is predetermined as shared|"
+ "global variable is predetermined as shared|"
+ "variable with automatic storage duration is predetermined as private}0"
+ "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
def err_omp_loop_var_dsa : Error<
"loop iteration variable may not be %0">;
def err_omp_not_for : Error<
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Jun 19 04:13:45 2014
@@ -39,6 +39,7 @@ enum DefaultDataSharingAttributes {
DSA_none = 1 << 0, /// \brief Default data sharing attribute 'none'.
DSA_shared = 1 << 1 /// \brief Default data sharing attribute 'shared'.
};
+
template <class T> struct MatchesAny {
explicit MatchesAny(ArrayRef<T> Arr) : Arr(std::move(Arr)) {}
bool operator()(T Kind) {
@@ -53,8 +54,7 @@ private:
};
struct MatchesAlways {
MatchesAlways() {}
- template <class T>
- bool operator()(T) { return true; }
+ template <class T> bool operator()(T) { return true; }
};
typedef MatchesAny<OpenMPClauseKind> MatchesAnyClause;
@@ -100,7 +100,7 @@ private:
/// \brief Stack of used declaration and their data-sharing attributes.
StackTy Stack;
- Sema &Actions;
+ Sema &SemaRef;
typedef SmallVector<SharingMapTy, 8>::reverse_iterator reverse_iterator;
@@ -110,7 +110,7 @@ private:
bool isOpenMPLocal(VarDecl *D, StackTy::reverse_iterator Iter);
public:
- explicit DSAStackTy(Sema &S) : Stack(1), Actions(S) {}
+ explicit DSAStackTy(Sema &S) : Stack(1), SemaRef(S) {}
void push(OpenMPDirectiveKind DKind, const DeclarationNameInfo &DirName,
Scope *CurScope) {
@@ -353,8 +353,8 @@ DSAStackTy::DSAVarData DSAStackTy::getTo
if (D->isStaticDataMember()) {
// Variables with const-qualified type having no mutable member may be
// listed in a firstprivate clause, even if they are static data members.
- DSAVarData DVarTemp = hasDSA(D, MatchesAnyClause(OMPC_firstprivate),
- MatchesAlways());
+ DSAVarData DVarTemp =
+ hasDSA(D, MatchesAnyClause(OMPC_firstprivate), MatchesAlways());
if (DVarTemp.CKind == OMPC_firstprivate && DVarTemp.RefExpr)
return DVar;
@@ -363,7 +363,7 @@ DSAStackTy::DSAVarData DSAStackTy::getTo
}
QualType Type = D->getType().getNonReferenceType().getCanonicalType();
- bool IsConstant = Type.isConstant(Actions.getASTContext());
+ bool IsConstant = Type.isConstant(SemaRef.getASTContext());
while (Type->isArrayType()) {
QualType ElemType = cast<ArrayType>(Type.getTypePtr())->getElementType();
Type = ElemType.getNonReferenceType().getCanonicalType();
@@ -373,13 +373,13 @@ DSAStackTy::DSAVarData DSAStackTy::getTo
// Variables with const qualified type having no mutable member are
// shared.
CXXRecordDecl *RD =
- Actions.getLangOpts().CPlusPlus ? Type->getAsCXXRecordDecl() : nullptr;
+ SemaRef.getLangOpts().CPlusPlus ? Type->getAsCXXRecordDecl() : nullptr;
if (IsConstant &&
- !(Actions.getLangOpts().CPlusPlus && RD && RD->hasMutableFields())) {
+ !(SemaRef.getLangOpts().CPlusPlus && RD && RD->hasMutableFields())) {
// Variables with const-qualified type having no mutable member may be
// listed in a firstprivate clause, even if they are static data members.
- DSAVarData DVarTemp = hasDSA(D, MatchesAnyClause(OMPC_firstprivate),
- MatchesAlways());
+ DSAVarData DVarTemp =
+ hasDSA(D, MatchesAnyClause(OMPC_firstprivate), MatchesAlways());
if (DVarTemp.CKind == OMPC_firstprivate && DVarTemp.RefExpr)
return DVar;
@@ -515,16 +515,16 @@ namespace {
class VarDeclFilterCCC : public CorrectionCandidateCallback {
private:
- Sema &Actions;
+ Sema &SemaRef;
public:
- explicit VarDeclFilterCCC(Sema &S) : Actions(S) {}
+ explicit VarDeclFilterCCC(Sema &S) : SemaRef(S) {}
bool ValidateCandidate(const TypoCorrection &Candidate) override {
NamedDecl *ND = Candidate.getCorrectionDecl();
if (VarDecl *VD = dyn_cast_or_null<VarDecl>(ND)) {
return VD->hasGlobalStorage() &&
- Actions.isDeclInScope(ND, Actions.getCurLexicalContext(),
- Actions.getCurScope());
+ SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(),
+ SemaRef.getCurScope());
}
return false;
}
@@ -754,10 +754,54 @@ Sema::CheckOMPThreadPrivateDecl(SourceLo
return D;
}
+static void ReportOriginalDSA(Sema &SemaRef, DSAStackTy *Stack,
+ const VarDecl *VD, DSAStackTy::DSAVarData DVar,
+ bool IsLoopIterVar = false) {
+ if (DVar.RefExpr) {
+ SemaRef.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
+ << getOpenMPClauseName(DVar.CKind);
+ return;
+ }
+ enum {
+ PDSA_StaticMemberShared,
+ PDSA_StaticLocalVarShared,
+ PDSA_LoopIterVarPrivate,
+ PDSA_LoopIterVarLinear,
+ PDSA_LoopIterVarLastprivate,
+ PDSA_ConstVarShared,
+ PDSA_GlobalVarShared,
+ PDSA_LocalVarPrivate
+ } Reason;
+ bool ReportHint = false;
+ if (IsLoopIterVar) {
+ if (DVar.CKind == OMPC_private)
+ Reason = PDSA_LoopIterVarPrivate;
+ else if (DVar.CKind == OMPC_lastprivate)
+ Reason = PDSA_LoopIterVarLastprivate;
+ else
+ Reason = PDSA_LoopIterVarLinear;
+ } else if (VD->isStaticLocal())
+ Reason = PDSA_StaticLocalVarShared;
+ else if (VD->isStaticDataMember())
+ Reason = PDSA_StaticMemberShared;
+ else if (VD->isFileVarDecl())
+ Reason = PDSA_GlobalVarShared;
+ else if (VD->getType().isConstant(SemaRef.getASTContext()))
+ Reason = PDSA_ConstVarShared;
+ else {
+ ReportHint = true;
+ Reason = PDSA_LocalVarPrivate;
+ }
+
+ SemaRef.Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
+ << Reason << ReportHint
+ << getOpenMPDirectiveName(Stack->getCurrentDirective());
+}
+
namespace {
class DSAAttrChecker : public StmtVisitor<DSAAttrChecker, void> {
DSAStackTy *Stack;
- Sema &Actions;
+ Sema &SemaRef;
bool ErrorFound;
CapturedStmt *CS;
llvm::SmallVector<Expr *, 8> ImplicitFirstprivate;
@@ -786,7 +830,7 @@ public:
if (DVar.CKind == OMPC_unknown && Stack->getDefaultDSA() == DSA_none &&
(isOpenMPParallelDirective(DKind) || DKind == OMPD_task)) {
ErrorFound = true;
- Actions.Diag(ELoc, diag::err_omp_no_dsa_for_variable) << VD;
+ SemaRef.Diag(ELoc, diag::err_omp_no_dsa_for_variable) << VD;
return;
}
@@ -798,11 +842,8 @@ public:
MatchesAlways());
if (DKind == OMPD_task && DVar.CKind == OMPC_reduction) {
ErrorFound = true;
- Actions.Diag(ELoc, diag::err_omp_reduction_in_task);
- if (DVar.RefExpr) {
- Actions.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(OMPC_reduction);
- }
+ SemaRef.Diag(ELoc, diag::err_omp_reduction_in_task);
+ ReportOriginalDSA(SemaRef, Stack, VD, DVar);
return;
}
@@ -830,8 +871,8 @@ public:
bool isErrorFound() { return ErrorFound; }
ArrayRef<Expr *> getImplicitFirstprivate() { return ImplicitFirstprivate; }
- DSAAttrChecker(DSAStackTy *S, Sema &Actions, CapturedStmt *CS)
- : Stack(S), Actions(Actions), ErrorFound(false), CS(CS) {}
+ DSAAttrChecker(DSAStackTy *S, Sema &SemaRef, CapturedStmt *CS)
+ : Stack(S), SemaRef(SemaRef), ErrorFound(false), CS(CS) {}
};
} // namespace
@@ -1363,19 +1404,14 @@ static bool CheckOpenMPIterationSpace(Op
// associated for-loop.
SemaRef.Diag(Init->getLocStart(), diag::err_omp_loop_var_dsa)
<< getOpenMPClauseName(DVar.CKind);
- if (DVar.RefExpr)
- SemaRef.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- else
- SemaRef.Diag(Var->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(SemaRef, &DSA, Var, DVar, true);
HasErrors = true;
} else {
// Make the loop iteration variable private by default.
DSA.addDSA(Var, nullptr, OMPC_private);
}
- assert(isOpenMPLoopDirective(DKind) && "DSA for non-simd loop vars");
+ assert(isOpenMPLoopDirective(DKind) && "DSA for non-loop vars");
// Check test-expr.
HasErrors |= ISC.CheckCond(For->getCond());
@@ -1907,13 +1943,7 @@ OMPClause *Sema::ActOnOpenMPPrivateClaus
if (DVar.CKind != OMPC_unknown && DVar.CKind != OMPC_private) {
Diag(ELoc, diag::err_omp_wrong_dsa) << getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_private);
- if (DVar.RefExpr) {
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- } else {
- Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
- }
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
@@ -2046,8 +2076,7 @@ OMPClause *Sema::ActOnOpenMPFirstprivate
Diag(ELoc, diag::err_omp_wrong_dsa)
<< getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_firstprivate);
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
@@ -2067,8 +2096,7 @@ OMPClause *Sema::ActOnOpenMPFirstprivate
Diag(ELoc, diag::err_omp_wrong_dsa)
<< getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_firstprivate);
- Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
@@ -2084,10 +2112,7 @@ OMPClause *Sema::ActOnOpenMPFirstprivate
Diag(ELoc, diag::err_omp_required_access)
<< getOpenMPClauseName(OMPC_firstprivate)
<< getOpenMPClauseName(OMPC_shared);
- if (DVar.RefExpr) {
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- }
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
}
@@ -2181,12 +2206,7 @@ OMPClause *Sema::ActOnOpenMPLastprivateC
Diag(ELoc, diag::err_omp_wrong_dsa)
<< getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_lastprivate);
- if (DVar.RefExpr)
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- else
- Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
@@ -2203,12 +2223,7 @@ OMPClause *Sema::ActOnOpenMPLastprivateC
Diag(ELoc, diag::err_omp_required_access)
<< getOpenMPClauseName(OMPC_lastprivate)
<< getOpenMPClauseName(OMPC_shared);
- if (DVar.RefExpr)
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- else
- Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
}
@@ -2328,8 +2343,7 @@ OMPClause *Sema::ActOnOpenMPSharedClause
DVar.RefExpr) {
Diag(ELoc, diag::err_omp_wrong_dsa) << getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_shared);
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
@@ -2585,13 +2599,7 @@ OMPClause *Sema::ActOnOpenMPReductionCla
Diag(ELoc, diag::err_omp_wrong_dsa)
<< getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_reduction);
- if (DVar.RefExpr) {
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- } else {
- Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
- }
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
@@ -2606,10 +2614,7 @@ OMPClause *Sema::ActOnOpenMPReductionCla
Diag(ELoc, diag::err_omp_required_access)
<< getOpenMPClauseName(OMPC_reduction)
<< getOpenMPClauseName(OMPC_shared);
- if (DVar.RefExpr) {
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- }
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
}
@@ -2716,8 +2721,7 @@ OMPClause *Sema::ActOnOpenMPLinearClause
if (DVar.RefExpr) {
Diag(ELoc, diag::err_omp_wrong_dsa) << getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_linear);
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
Modified: cfe/trunk/test/OpenMP/for_ast_print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_ast_print.cpp?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/for_ast_print.cpp Thu Jun 19 04:13:45 2014
@@ -14,19 +14,21 @@ T tmain(T argc) {
static T a;
// CHECK: static T a;
#pragma omp for
-// CHECK-NEXT: #pragma omp for
- for (int i=0; i < 2; ++i) a=2;
+ // CHECK-NEXT: #pragma omp for
+ for (int i = 0; i < 2; ++i)
+ a = 2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: a = 2;
#pragma omp parallel
-#pragma omp for private(argc,b),firstprivate(c, d),lastprivate(d,f) collapse(N)
+#pragma omp for private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N)
for (int i = 0; i < 10; ++i)
- for (int j = 0; j < 10; ++j)foo();
-// CHECK-NEXT: #pragma omp parallel
-// CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N)
-// CHECK-NEXT: for (int i = 0; i < 10; ++i)
-// CHECK-NEXT: for (int j = 0; j < 10; ++j)
-// CHECK-NEXT: foo();
+ for (int j = 0; j < 10; ++j)
+ foo();
+ // CHECK-NEXT: #pragma omp parallel
+ // CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N)
+ // CHECK-NEXT: for (int i = 0; i < 10; ++i)
+ // CHECK-NEXT: for (int j = 0; j < 10; ++j)
+ // CHECK-NEXT: foo();
return T();
}
@@ -35,19 +37,21 @@ int main(int argc, char **argv) {
static int a;
// CHECK: static int a;
#pragma omp for
-// CHECK-NEXT: #pragma omp for
- for (int i=0; i < 2; ++i)a=2;
+ // CHECK-NEXT: #pragma omp for
+ for (int i = 0; i < 2; ++i)
+ a = 2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: a = 2;
#pragma omp parallel
-#pragma omp for private(argc,b),firstprivate(argv, c),lastprivate(d,f) collapse(2)
+#pragma omp for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2)
for (int i = 0; i < 10; ++i)
- for (int j = 0; j < 10; ++j)foo();
-// CHECK-NEXT: #pragma omp parallel
-// CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2)
-// CHECK-NEXT: for (int i = 0; i < 10; ++i)
-// CHECK-NEXT: for (int j = 0; j < 10; ++j)
-// CHECK-NEXT: foo();
+ for (int j = 0; j < 10; ++j)
+ foo();
+ // CHECK-NEXT: #pragma omp parallel
+ // CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2)
+ // CHECK-NEXT: for (int i = 0; i < 10; ++i)
+ // CHECK-NEXT: for (int j = 0; j < 10; ++j)
+ // CHECK-NEXT: foo();
return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
}
Modified: cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp Thu Jun 19 04:13:45 2014
@@ -65,7 +65,7 @@ int foomain(int argc, char **argv) {
I e(4); // expected-note {{'e' defined here}}
C g(5); // expected-note 2 {{'g' defined here}}
int i;
- int &j = i; // expected-note {{'j' defined here}}
+ int &j = i; // expected-note {{'j' defined here}}
#pragma omp parallel
#pragma omp for firstprivate // expected-error {{expected '(' after 'firstprivate'}}
for (int k = 0; k < argc; ++k)
@@ -121,7 +121,7 @@ int foomain(int argc, char **argv) {
#pragma omp parallel
{
int v = 0;
- int i; // expected-note {{predetermined as private}}
+ int i; // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
#pragma omp for firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
for (int k = 0; k < argc; ++k) {
i = k;
@@ -146,7 +146,7 @@ int foomain(int argc, char **argv) {
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel reduction(+ : i) // expected-note {{defined as reduction}}
-#pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}}
+#pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}}
for (i = 0; i < argc; ++i)
foo();
return 0;
@@ -160,7 +160,7 @@ int main(int argc, char **argv) {
S3 m;
S6 n(2);
int i;
- int &j = i; // expected-note {{'j' defined here}}
+ int &j = i; // expected-note {{'j' defined here}}
#pragma omp parallel
#pragma omp for firstprivate // expected-error {{expected '(' after 'firstprivate'}}
for (i = 0; i < argc; ++i)
@@ -273,7 +273,7 @@ int main(int argc, char **argv) {
#pragma omp parallel
{
int v = 0;
- int i; // expected-note {{predetermined as private}}
+ int i; // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
#pragma omp for firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
for (int k = 0; k < argc; ++k) {
i = k;
@@ -285,7 +285,7 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel reduction(+ : i) // expected-note {{defined as reduction}}
-#pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}}
+#pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}}
for (i = 0; i < argc; ++i)
foo();
Modified: cfe/trunk/test/OpenMP/for_lastprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_lastprivate_messages.cpp?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_lastprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_lastprivate_messages.cpp Thu Jun 19 04:13:45 2014
@@ -15,10 +15,10 @@ class S2 {
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note {{predetermined as shared}}
+ static float S2s; // expected-note {{static data member is predetermined as shared}}
static const float S2sc;
};
-const float S2::S2sc = 0; // expected-note {{predetermined as shared}}
+const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
const S2 b;
const S2 ba[5];
class S3 { // expected-note 2 {{'S3' declared here}}
@@ -29,9 +29,9 @@ public:
S3() : a(0) {}
S3(S3 &s3) : a(s3.a) {}
};
-const S3 c; // expected-note {{predetermined as shared}}
-const S3 ca[5]; // expected-note {{predetermined as shared}}
-extern const int f; // expected-note {{predetermined as shared}}
+const S3 c; // expected-note {{global variable is predetermined as shared}}
+const S3 ca[5]; // expected-note {{global variable is predetermined as shared}}
+extern const int f; // expected-note {{global variable is predetermined as shared}}
class S4 { // expected-note 3 {{'S4' declared here}}
int a;
S4();
@@ -121,7 +121,7 @@ int foomain(int argc, char **argv) {
#pragma omp parallel
{
int v = 0;
- int i; // expected-note {{predetermined as private}}
+ int i; // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
#pragma omp for lastprivate(i) // expected-error {{lastprivate variable must be shared}}
for (int k = 0; k < argc; ++k) {
i = k;
@@ -141,8 +141,8 @@ int foomain(int argc, char **argv) {
}
int main(int argc, char **argv) {
- const int d = 5; // expected-note {{predetermined as shared}}
- const int da[5] = {0}; // expected-note {{predetermined as shared}}
+ const int d = 5; // expected-note {{constant variable is predetermined as shared}}
+ const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}}
S4 e(4); // expected-note {{'e' defined here}}
S5 g(5); // expected-note {{'g' defined here}}
S3 m; // expected-note 2 {{'m' defined here}}
Modified: cfe/trunk/test/OpenMP/for_private_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_private_messages.cpp?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_private_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_private_messages.cpp Thu Jun 19 04:13:45 2014
@@ -11,77 +11,100 @@ struct S1; // expected-note 2 {{declared
extern S1 a;
class S2 {
mutable int a;
+
public:
- S2():a(0) { }
+ S2() : a(0) {}
};
const S2 b;
const S2 ba[5];
class S3 {
int a;
+
public:
- S3():a(0) { }
+ S3() : a(0) {}
};
const S3 ca[5];
class S4 { // expected-note {{'S4' declared here}}
int a;
S4();
+
public:
- S4(int v):a(v) { }
+ S4(int v) : a(v) {}
};
class S5 { // expected-note {{'S5' declared here}}
int a;
- S5():a(0) {}
+ S5() : a(0) {}
+
public:
- S5(int v):a(v) { }
+ S5(int v) : a(v) {}
};
S3 h;
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
-template<class I, class C> int foomain(I argc, C **argv) {
+template <class I, class C>
+int foomain(I argc, C **argv) {
I e(4);
I g(5);
int i;
- int &j = i; // expected-note {{'j' defined here}}
- #pragma omp for private // expected-error {{expected '(' after 'private'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private () // expected-error {{expected expression}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc)
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (S1) // expected-error {{'S1' does not refer to a value}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (a, b) // expected-error {{private variable with incomplete type 'S1'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argv[1]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private(e, g)
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp parallel
+ int &j = i; // expected-note {{'j' defined here}}
+#pragma omp for private // expected-error {{expected '(' after 'private'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private() // expected-error {{expected expression}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc)
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(S1) // expected-error {{'S1' does not refer to a value}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argv[1]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(e, g)
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp parallel
{
int v = 0;
int i;
- #pragma omp for private(i)
- for (int k = 0; k < argc; ++k) { i = k; v += i; }
+#pragma omp for private(i)
+ for (int k = 0; k < argc; ++k) {
+ i = k;
+ v += i;
+ }
}
- #pragma omp parallel shared(i)
- #pragma omp parallel private(i)
- #pragma omp for private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private(i)
- for (int k = 0; k < argc; ++k) ++k;
+#pragma omp parallel shared(i)
+#pragma omp parallel private(i)
+#pragma omp for private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(i)
+ for (int k = 0; k < argc; ++k)
+ ++k;
return 0;
}
@@ -89,45 +112,61 @@ int main(int argc, char **argv) {
S4 e(4); // expected-note {{'e' defined here}}
S5 g(5); // expected-note {{'g' defined here}}
int i;
- int &j = i; // expected-note {{'j' defined here}}
- #pragma omp for private // expected-error {{expected '(' after 'private'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private () // expected-error {{expected expression}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc)
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (S1) // expected-error {{'S1' does not refer to a value}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (a, b) // expected-error {{private variable with incomplete type 'S1'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argv[1]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private(e, g) // expected-error 2 {{private variable must have an accessible, unambiguous default constructor}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp parallel
+ int &j = i; // expected-note {{'j' defined here}}
+#pragma omp for private // expected-error {{expected '(' after 'private'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private() // expected-error {{expected expression}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc)
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(S1) // expected-error {{'S1' does not refer to a value}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argv[1]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(e, g) // expected-error 2 {{private variable must have an accessible, unambiguous default constructor}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp parallel
{
int i;
- #pragma omp for private(i)
- for (int k = 0; k < argc; ++k) ++k;
+#pragma omp for private(i)
+ for (int k = 0; k < argc; ++k)
+ ++k;
}
- #pragma omp parallel shared(i)
- #pragma omp parallel private(i)
- #pragma omp for private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private(i)
- for (int k = 0; k < argc; ++k) ++k;
+#pragma omp parallel shared(i)
+#pragma omp parallel private(i)
+#pragma omp for private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(i)
+ for (int k = 0; k < argc; ++k)
+ ++k;
return 0;
}
Modified: cfe/trunk/test/OpenMP/for_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_reduction_messages.cpp?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_reduction_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_reduction_messages.cpp Thu Jun 19 04:13:45 2014
@@ -16,7 +16,7 @@ class S2 {
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note 2 {{predetermined as shared}}
+ static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
Modified: cfe/trunk/test/OpenMP/no_option.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/no_option.c?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/no_option.c (original)
+++ cfe/trunk/test/OpenMP/no_option.c Thu Jun 19 04:13:45 2014
@@ -2,5 +2,5 @@
// expected-no-diagnostics
int a;
-#pragma omp threadprivate(a,b)
+#pragma omp threadprivate(a, b)
#pragma omp parallel
Modified: cfe/trunk/test/OpenMP/no_option_no_warn.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/no_option_no_warn.c?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/no_option_no_warn.c (original)
+++ cfe/trunk/test/OpenMP/no_option_no_warn.c Thu Jun 19 04:13:45 2014
@@ -2,5 +2,5 @@
// expected-no-diagnostics
int a;
-#pragma omp threadprivate(a,b)
+#pragma omp threadprivate(a, b)
#pragma omp parallel
Modified: cfe/trunk/test/OpenMP/parallel_private_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_private_messages.cpp?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_private_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_private_messages.cpp Thu Jun 19 04:13:45 2014
@@ -13,7 +13,7 @@ class S2 {
mutable int a;
public:
S2():a(0) { }
- static float S2s; // expected-note {{predetermined as shared}}
+ static float S2s; // expected-note {{static data member is predetermined as shared}}
};
const S2 b;
const S2 ba[5];
@@ -22,9 +22,9 @@ class S3 {
public:
S3():a(0) { }
};
-const S3 c; // expected-note {{predetermined as shared}}
-const S3 ca[5]; // expected-note {{predetermined as shared}}
-extern const int f; // expected-note {{predetermined as shared}}
+const S3 c; // expected-note {{global variable is predetermined as shared}}
+const S3 ca[5]; // expected-note {{global variable is predetermined as shared}}
+extern const int f; // expected-note {{global variable is predetermined as shared}}
class S4 { // expected-note {{'S4' declared here}}
int a;
S4();
@@ -42,8 +42,8 @@ int threadvar;
#pragma omp threadprivate(threadvar) // expected-note {{defined as threadprivate or thread local}}
int main(int argc, char **argv) {
- const int d = 5; // expected-note {{predetermined as shared}}
- const int da[5] = { 0 }; // expected-note {{predetermined as shared}}
+ const int d = 5; // expected-note {{constant variable is predetermined as shared}}
+ const int da[5] = { 0 }; // expected-note {{constant variable is predetermined as shared}}
S4 e(4); // expected-note {{'e' defined here}}
S5 g(5); // expected-note {{'g' defined here}}
int i;
Modified: cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp Thu Jun 19 04:13:45 2014
@@ -16,7 +16,7 @@ class S2 {
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note 2 {{predetermined as shared}}
+ static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
Modified: cfe/trunk/test/OpenMP/simd_lastprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/simd_lastprivate_messages.cpp?rev=211262&r1=211261&r2=211262&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/simd_lastprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/simd_lastprivate_messages.cpp Thu Jun 19 04:13:45 2014
@@ -11,150 +11,198 @@ struct S1; // expected-note 2 {{declared
extern S1 a;
class S2 {
mutable int a;
+
public:
- S2():a(0) { }
- S2(S2 &s2):a(s2.a) { }
- static float S2s; // expected-note {{predetermined as shared}}
+ S2() : a(0) {}
+ S2(S2 &s2) : a(s2.a) {}
+ static float S2s; // expected-note {{static data member is predetermined as shared}}
static const float S2sc;
};
-const float S2::S2sc = 0; // expected-note {{predetermined as shared}}
+const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
const S2 b;
const S2 ba[5];
class S3 { // expected-note {{'S3' declared here}}
int a;
- S3& operator =(const S3& s3);
+ S3 &operator=(const S3 &s3);
+
public:
- S3():a(0) { }
- S3(S3 &s3):a(s3.a) { }
+ S3() : a(0) {}
+ S3(S3 &s3) : a(s3.a) {}
};
-const S3 c; // expected-note {{predetermined as shared}}
-const S3 ca[5]; // expected-note {{predetermined as shared}}
-extern const int f; // expected-note {{predetermined as shared}}
-class S4 { // expected-note {{'S4' declared here}}
+const S3 c; // expected-note {{global variable is predetermined as shared}}
+const S3 ca[5]; // expected-note {{global variable is predetermined as shared}}
+extern const int f; // expected-note {{global variable is predetermined as shared}}
+class S4 { // expected-note {{'S4' declared here}}
int a;
S4();
S4(const S4 &s4);
+
public:
- S4(int v):a(v) { }
+ S4(int v) : a(v) {}
};
class S5 { // expected-note {{'S5' declared here}}
int a;
- S5():a(0) {}
+ S5() : a(0) {}
+
public:
- S5(const S5 &s5):a(s5.a) { }
- S5(int v):a(v) { }
+ S5(const S5 &s5) : a(s5.a) {}
+ S5(int v) : a(v) {}
};
S3 h;
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
-template<class I, class C> int foomain(I argc, C **argv) {
+template <class I, class C>
+int foomain(I argc, C **argv) {
I e(4);
I g(5);
int i;
- int &j = i; // expected-note {{'j' defined here}}
- #pragma omp simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate () // expected-error {{expected expression}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (argc)
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (S1) // expected-error {{'S1' does not refer to a value}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (argv[1]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate(e, g)
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd firstprivate(i) // expected-error {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp parallel
+ int &j = i; // expected-note {{'j' defined here}}
+#pragma omp simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate() // expected-error {{expected expression}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(argc)
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(argv[1]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(e, g)
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd firstprivate(i) // expected-error {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp parallel
{
int v = 0;
int i;
- #pragma omp simd lastprivate(i)
- for (int k = 0; k < argc; ++k) { i = k; v += i; }
+#pragma omp simd lastprivate(i)
+ for (int k = 0; k < argc; ++k) {
+ i = k;
+ v += i;
+ }
}
- #pragma omp parallel shared(i)
- #pragma omp parallel private(i)
- #pragma omp simd lastprivate (j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate(i)
- for (int k = 0; k < argc; ++k) ++k;
+#pragma omp parallel shared(i)
+#pragma omp parallel private(i)
+#pragma omp simd lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(i)
+ for (int k = 0; k < argc; ++k)
+ ++k;
return 0;
}
int main(int argc, char **argv) {
- const int d = 5; // expected-note {{predetermined as shared}}
- const int da[5] = { 0 }; // expected-note {{predetermined as shared}}
- S4 e(4); // expected-note {{'e' defined here}}
- S5 g(5); // expected-note {{'g' defined here}}
- S3 m; // expected-note {{'m' defined here}}
+ const int d = 5; // expected-note {{constant variable is predetermined as shared}}
+ const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}}
+ S4 e(4); // expected-note {{'e' defined here}}
+ S5 g(5); // expected-note {{'g' defined here}}
+ S3 m; // expected-note {{'m' defined here}}
int i;
- int &j = i; // expected-note {{'j' defined here}}
- #pragma omp simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate () // expected-error {{expected expression}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (argc)
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (S1) // expected-error {{'S1' does not refer to a value}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 3 {{shared variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (argv[1]) // expected-error {{expected variable name}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (2*2) // expected-error {{expected variable name}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(ba)
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(ca) // expected-error {{shared variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(da) // expected-error {{shared variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
+ int &j = i; // expected-note {{'j' defined here}}
+#pragma omp simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate() // expected-error {{expected expression}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(argc)
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 3 {{shared variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(argv[1]) // expected-error {{expected variable name}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(2 * 2) // expected-error {{expected variable name}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(ba)
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(ca) // expected-error {{shared variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(da) // expected-error {{shared variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
int xa;
- #pragma omp simd lastprivate(xa) // OK
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd firstprivate (g) // expected-error {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(e, g) // expected-error 2 {{lastprivate variable must have an accessible, unambiguous default constructor}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(m) // expected-error {{lastprivate variable must have an accessible, unambiguous copy assignment operator}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(i)
- for (i = 0; i < argc; ++i) foo();
- #pragma omp parallel private(xa)
- #pragma omp simd lastprivate(xa) // OK: may be lastprivate
- for (i = 0; i < argc; ++i) foo();
- #pragma omp parallel
- #pragma omp simd lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}}
- for (i = 0; i < argc; ++i) foo();
+#pragma omp simd lastprivate(xa) // OK
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd firstprivate(g) // expected-error {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(e, g) // expected-error 2 {{lastprivate variable must have an accessible, unambiguous default constructor}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(m) // expected-error {{lastprivate variable must have an accessible, unambiguous copy assignment operator}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(i)
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel private(xa)
+#pragma omp simd lastprivate(xa) // OK: may be lastprivate
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel
+#pragma omp simd lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}}
+ for (i = 0; i < argc; ++i)
+ foo();
return 0;
}
More information about the cfe-commits
mailing list