forked from OSchip/llvm-project
[OpenMP] Add firstprivate as a default data-sharing attribute to clang
This implements the default(firstprivate) clause as defined in OpenMP Technical Report 8 (2.22.4). Reviewed By: jdoerfert, ABataev Differential Revision: https://reviews.llvm.org/D75591
This commit is contained in:
parent
c94332919b
commit
78443666bc
|
@ -51,3 +51,12 @@ Example
|
|||
// WARNING: OpenMP directive ``parallel`` specifies ``default(shared)``
|
||||
// clause. Consider using ``default(none)`` clause instead.
|
||||
}
|
||||
|
||||
// ``parallel`` directive can have ``default`` clause, and said clause is
|
||||
// specified, but with ``firstprivate`` kind, which is not ``none``, diagnose.
|
||||
void p0_3() {
|
||||
#pragma omp parallel default(firstprivate)
|
||||
;
|
||||
// WARNING: OpenMP directive ``parallel`` specifies ``default(firstprivate)``
|
||||
// clause. Consider using ``default(none)`` clause instead.
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: %check_clang_tidy %s openmp-use-default-none %t -- -- -fopenmp=libomp -fopenmp-version=40
|
||||
// RUN: %check_clang_tidy -std=c11 %s openmp-use-default-none %t -- -- -x c -fopenmp=libomp -fopenmp-version=40
|
||||
// RUN: %check_clang_tidy %s openmp-use-default-none %t -- -- -fopenmp=libomp -fopenmp-version=51
|
||||
// RUN: %check_clang_tidy -std=c11 %s openmp-use-default-none %t -- -- -x c -fopenmp=libomp -fopenmp-version=51
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// Null cases.
|
||||
|
@ -42,6 +42,15 @@ void p0_2() {
|
|||
// CHECK-NOTES: :[[@LINE-3]]:22: note: existing 'default' clause specified here
|
||||
}
|
||||
|
||||
// 'parallel' directive can have 'default' clause, and said clause specified,
|
||||
// but with 'firstprivate' kind, which is not 'none', diagnose.
|
||||
void p0_3() {
|
||||
#pragma omp parallel default(firstprivate)
|
||||
;
|
||||
// CHECK-NOTES: :[[@LINE-2]]:1: warning: OpenMP directive 'parallel' specifies 'default(firstprivate)' clause, consider using 'default(none)' clause instead
|
||||
// CHECK-NOTES: :[[@LINE-3]]:22: note: existing 'default' clause specified here
|
||||
}
|
||||
|
||||
// 'task' directive.
|
||||
|
||||
// 'task' directive can have 'default' clause, but said clause is not
|
||||
|
@ -68,6 +77,15 @@ void p1_2() {
|
|||
// CHECK-NOTES: :[[@LINE-3]]:18: note: existing 'default' clause specified here
|
||||
}
|
||||
|
||||
// 'task' directive can have 'default' clause, and said clause specified,
|
||||
// but with 'firstprivate' kind, which is not 'none', diagnose.
|
||||
void p1_3() {
|
||||
#pragma omp task default(firstprivate)
|
||||
;
|
||||
// CHECK-NOTES: :[[@LINE-2]]:1: warning: OpenMP directive 'task' specifies 'default(firstprivate)' clause, consider using 'default(none)' clause instead
|
||||
// CHECK-NOTES: :[[@LINE-3]]:18: note: existing 'default' clause specified here
|
||||
}
|
||||
|
||||
// 'teams' directive. (has to be inside of 'target' directive)
|
||||
|
||||
// 'teams' directive can have 'default' clause, but said clause is not
|
||||
|
@ -97,6 +115,16 @@ void p2_2() {
|
|||
// CHECK-NOTES: :[[@LINE-3]]:19: note: existing 'default' clause specified here
|
||||
}
|
||||
|
||||
// 'teams' directive can have 'default' clause, and said clause specified,
|
||||
// but with 'firstprivate' kind, which is not 'none', diagnose.
|
||||
void p2_3() {
|
||||
#pragma omp target
|
||||
#pragma omp teams default(firstprivate)
|
||||
;
|
||||
// CHECK-NOTES: :[[@LINE-2]]:1: warning: OpenMP directive 'teams' specifies 'default(firstprivate)' clause, consider using 'default(none)' clause instead
|
||||
// CHECK-NOTES: :[[@LINE-3]]:19: note: existing 'default' clause specified here
|
||||
}
|
||||
|
||||
// 'taskloop' directive.
|
||||
|
||||
// 'taskloop' directive can have 'default' clause, but said clause is not
|
||||
|
@ -126,6 +154,16 @@ void p3_2(const int a) {
|
|||
// CHECK-NOTES: :[[@LINE-4]]:22: note: existing 'default' clause specified here
|
||||
}
|
||||
|
||||
// 'taskloop' directive can have 'default' clause, and said clause specified,
|
||||
// but with 'firstprivate' kind, which is not 'none', diagnose.
|
||||
void p3_3(const int a) {
|
||||
#pragma omp taskloop default(firstprivate)
|
||||
for (int b = 0; b < a; b++)
|
||||
;
|
||||
// CHECK-NOTES: :[[@LINE-3]]:1: warning: OpenMP directive 'taskloop' specifies 'default(firstprivate)' clause, consider using 'default(none)' clause instead
|
||||
// CHECK-NOTES: :[[@LINE-4]]:22: note: existing 'default' clause specified here
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// Combined directives.
|
||||
// Let's not test every single possible permutation/combination of directives,
|
||||
|
@ -158,3 +196,13 @@ void p4_2(const int a) {
|
|||
// CHECK-NOTES: :[[@LINE-3]]:1: warning: OpenMP directive 'parallel for' specifies 'default(shared)' clause, consider using 'default(none)' clause instead
|
||||
// CHECK-NOTES: :[[@LINE-4]]:26: note: existing 'default' clause specified here
|
||||
}
|
||||
|
||||
// 'parallel' directive can have 'default' clause, and said clause specified,
|
||||
// but with 'firstprivate' kind, which is not 'none', diagnose.
|
||||
void p4_3(const int a) {
|
||||
#pragma omp parallel for default(firstprivate)
|
||||
for (int b = 0; b < a; b++)
|
||||
;
|
||||
// CHECK-NOTES: :[[@LINE-3]]:1: warning: OpenMP directive 'parallel for' specifies 'default(firstprivate)' clause, consider using 'default(none)' clause instead
|
||||
// CHECK-NOTES: :[[@LINE-4]]:26: note: existing 'default' clause specified here
|
||||
}
|
||||
|
|
|
@ -676,9 +676,10 @@ Given
|
|||
|
||||
#pragma omp parallel default(none)
|
||||
#pragma omp parallel default(shared)
|
||||
#pragma omp parallel default(firstprivate)
|
||||
#pragma omp parallel
|
||||
|
||||
``ompDefaultClause()`` matches ``default(none)`` and ``default(shared)``.
|
||||
``ompDefaultClause()`` matches ``default(none)``, ``default(shared)``, and ``default(firstprivate)``.
|
||||
</pre></td></tr>
|
||||
|
||||
|
||||
|
@ -3783,6 +3784,7 @@ Given
|
|||
#pragma omp parallel
|
||||
#pragma omp parallel default(none)
|
||||
#pragma omp parallel default(shared)
|
||||
#pragma omp parallel default(firstprivate)
|
||||
|
||||
``ompDefaultClause(isNoneKind())`` matches only ``default(none)``.
|
||||
</pre></td></tr>
|
||||
|
@ -3796,11 +3798,26 @@ Given
|
|||
#pragma omp parallel
|
||||
#pragma omp parallel default(none)
|
||||
#pragma omp parallel default(shared)
|
||||
#pragma omp parallel default(firstprivate)
|
||||
|
||||
``ompDefaultClause(isSharedKind())`` matches only ``default(shared)``.
|
||||
</pre></td></tr>
|
||||
|
||||
|
||||
<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPDefaultClause.html">OMPDefaultClause</a>></td><td class="name" onclick="toggle('isFirstPrivateKind0')"><a name="isFirstPrivateKind0Anchor">isSharedKind</a></td><td></td></tr>
|
||||
<tr><td colspan="4" class="doc" id="isFirstPrivateKind0"><pre>Matches if the OpenMP ``default`` clause has ``firstprivate`` kind specified.
|
||||
|
||||
Given
|
||||
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel default(none)
|
||||
#pragma omp parallel default(shared)
|
||||
#pragma omp parallel default(firstprivate)
|
||||
|
||||
``ompDefaultClause(isFirstPrivateKind())`` matches only ``default(firstprivate)``.
|
||||
</pre></td></tr>
|
||||
|
||||
|
||||
<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPExecutableDirective.html">OMPExecutableDirective</a>></td><td class="name" onclick="toggle('isAllowedToContainClauseKind0')"><a name="isAllowedToContainClauseKind0Anchor">isAllowedToContainClauseKind</a></td><td>OpenMPClauseKind CKind</td></tr>
|
||||
<tr><td colspan="4" class="doc" id="isAllowedToContainClauseKind0"><pre>Matches if the OpenMP directive is allowed to contain the specified OpenMP
|
||||
clause kind.
|
||||
|
|
|
@ -7190,10 +7190,12 @@ AST_MATCHER_P(OMPExecutableDirective, hasAnyClause,
|
|||
/// \code
|
||||
/// #pragma omp parallel default(none)
|
||||
/// #pragma omp parallel default(shared)
|
||||
/// #pragma omp parallel default(firstprivate)
|
||||
/// #pragma omp parallel
|
||||
/// \endcode
|
||||
///
|
||||
/// ``ompDefaultClause()`` matches ``default(none)`` and ``default(shared)``.
|
||||
/// ``ompDefaultClause()`` matches ``default(none)``, ``default(shared)``, and
|
||||
/// ``default(firstprivate)``
|
||||
extern const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause>
|
||||
ompDefaultClause;
|
||||
|
||||
|
@ -7205,6 +7207,7 @@ extern const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause>
|
|||
/// #pragma omp parallel
|
||||
/// #pragma omp parallel default(none)
|
||||
/// #pragma omp parallel default(shared)
|
||||
/// #pragma omp parallel default(firstprivate)
|
||||
/// \endcode
|
||||
///
|
||||
/// ``ompDefaultClause(isNoneKind())`` matches only ``default(none)``.
|
||||
|
@ -7220,6 +7223,7 @@ AST_MATCHER(OMPDefaultClause, isNoneKind) {
|
|||
/// #pragma omp parallel
|
||||
/// #pragma omp parallel default(none)
|
||||
/// #pragma omp parallel default(shared)
|
||||
/// #pragma omp parallel default(firstprivate)
|
||||
/// \endcode
|
||||
///
|
||||
/// ``ompDefaultClause(isSharedKind())`` matches only ``default(shared)``.
|
||||
|
@ -7227,6 +7231,24 @@ AST_MATCHER(OMPDefaultClause, isSharedKind) {
|
|||
return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_shared;
|
||||
}
|
||||
|
||||
/// Matches if the OpenMP ``default`` clause has ``firstprivate`` kind
|
||||
/// specified.
|
||||
///
|
||||
/// Given
|
||||
///
|
||||
/// \code
|
||||
/// #pragma omp parallel
|
||||
/// #pragma omp parallel default(none)
|
||||
/// #pragma omp parallel default(shared)
|
||||
/// #pragma omp parallel default(firstprivate)
|
||||
/// \endcode
|
||||
///
|
||||
/// ``ompDefaultClause(isFirstPrivateKind())`` matches only
|
||||
/// ``default(firstprivate)``.
|
||||
AST_MATCHER(OMPDefaultClause, isFirstPrivateKind) {
|
||||
return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_firstprivate;
|
||||
}
|
||||
|
||||
/// Matches if the OpenMP directive is allowed to contain the specified OpenMP
|
||||
/// clause kind.
|
||||
///
|
||||
|
|
|
@ -1334,6 +1334,8 @@ def warn_omp_more_one_device_type_clause
|
|||
InGroup<OpenMPClauses>;
|
||||
def err_omp_variant_ctx_second_match_extension : Error<
|
||||
"only a single match extension allowed per OpenMP context selector">;
|
||||
def err_omp_invalid_dsa: Error<
|
||||
"data-sharing attribute '%0' in '%1' clause requires OpenMP version %2 or above">;
|
||||
|
||||
// Pragma loop support.
|
||||
def err_pragma_loop_missing_argument : Error<
|
||||
|
|
|
@ -389,6 +389,7 @@ RegistryMaps::RegistryMaps() {
|
|||
REGISTER_MATCHER(isExpr);
|
||||
REGISTER_MATCHER(isExternC);
|
||||
REGISTER_MATCHER(isFinal);
|
||||
REGISTER_MATCHER(isFirstPrivateKind);
|
||||
REGISTER_MATCHER(isImplicit);
|
||||
REGISTER_MATCHER(isInStdNamespace);
|
||||
REGISTER_MATCHER(isInTemplateInstantiation);
|
||||
|
|
|
@ -1441,7 +1441,7 @@ bool Parser::parseOMPDeclareVariantMatchClause(SourceLocation Loc,
|
|||
/// Parsing of simple OpenMP clauses like 'default' or 'proc_bind'.
|
||||
///
|
||||
/// default-clause:
|
||||
/// 'default' '(' 'none' | 'shared' ')
|
||||
/// 'default' '(' 'none' | 'shared' | 'firstprivate' ')
|
||||
///
|
||||
/// proc_bind-clause:
|
||||
/// 'proc_bind' '(' 'master' | 'close' | 'spread' ')
|
||||
|
@ -2772,7 +2772,7 @@ OMPClause *Parser::ParseOpenMPSingleExprClause(OpenMPClauseKind Kind,
|
|||
/// Parsing of simple OpenMP clauses like 'default' or 'proc_bind'.
|
||||
///
|
||||
/// default-clause:
|
||||
/// 'default' '(' 'none' | 'shared' ')'
|
||||
/// 'default' '(' 'none' | 'shared' | 'firstprivate' ')'
|
||||
///
|
||||
/// proc_bind-clause:
|
||||
/// 'proc_bind' '(' 'master' | 'close' | 'spread' ')'
|
||||
|
@ -2785,6 +2785,14 @@ OMPClause *Parser::ParseOpenMPSimpleClause(OpenMPClauseKind Kind,
|
|||
llvm::Optional<SimpleClauseData> Val = parseOpenMPSimpleClause(*this, Kind);
|
||||
if (!Val || ParseOnly)
|
||||
return nullptr;
|
||||
if (getLangOpts().OpenMP < 51 && Kind == OMPC_default &&
|
||||
static_cast<DefaultKind>(Val.getValue().Type) ==
|
||||
OMP_DEFAULT_firstprivate) {
|
||||
Diag(Val.getValue().LOpen, diag::err_omp_invalid_dsa)
|
||||
<< getOpenMPClauseName(OMPC_firstprivate)
|
||||
<< getOpenMPClauseName(OMPC_default) << "5.1";
|
||||
return nullptr;
|
||||
}
|
||||
return Actions.ActOnOpenMPSimpleClause(
|
||||
Kind, Val.getValue().Type, Val.getValue().TypeLoc, Val.getValue().LOpen,
|
||||
Val.getValue().Loc, Val.getValue().RLoc);
|
||||
|
|
|
@ -56,6 +56,7 @@ enum DefaultDataSharingAttributes {
|
|||
DSA_unspecified = 0, /// Data sharing attribute not specified.
|
||||
DSA_none = 1 << 0, /// Default data sharing attribute 'none'.
|
||||
DSA_shared = 1 << 1, /// Default data sharing attribute 'shared'.
|
||||
DSA_firstprivate = 1 << 2, /// Default data sharing attribute 'firstprivate'.
|
||||
};
|
||||
|
||||
/// Stack for tracking declarations used in OpenMP directives and
|
||||
|
@ -684,6 +685,11 @@ public:
|
|||
getTopOfStack().DefaultAttr = DSA_shared;
|
||||
getTopOfStack().DefaultAttrLoc = Loc;
|
||||
}
|
||||
/// Set default data sharing attribute to firstprivate.
|
||||
void setDefaultDSAFirstPrivate(SourceLocation Loc) {
|
||||
getTopOfStack().DefaultAttr = DSA_firstprivate;
|
||||
getTopOfStack().DefaultAttrLoc = Loc;
|
||||
}
|
||||
/// Set default data mapping attribute to Modifier:Kind
|
||||
void setDefaultDMAAttr(OpenMPDefaultmapClauseModifier M,
|
||||
OpenMPDefaultmapClauseKind Kind,
|
||||
|
@ -1183,6 +1189,15 @@ DSAStackTy::DSAVarData DSAStackTy::getDSA(const_iterator &Iter,
|
|||
return DVar;
|
||||
case DSA_none:
|
||||
return DVar;
|
||||
case DSA_firstprivate:
|
||||
if (VD->getStorageDuration() == SD_Static &&
|
||||
VD->getDeclContext()->isFileContext()) {
|
||||
DVar.CKind = OMPC_unknown;
|
||||
} else {
|
||||
DVar.CKind = OMPC_firstprivate;
|
||||
}
|
||||
DVar.ImplicitDSALoc = Iter->DefaultAttrLoc;
|
||||
return DVar;
|
||||
case DSA_unspecified:
|
||||
// OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
|
||||
// in a Construct, implicitly determined, p.2]
|
||||
|
@ -2058,7 +2073,13 @@ bool Sema::isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level,
|
|||
// If the variable is artificial and must be captured by value - try to
|
||||
// capture by value.
|
||||
!(isa<OMPCapturedExprDecl>(D) && !D->hasAttr<OMPCaptureNoInitAttr>() &&
|
||||
!cast<OMPCapturedExprDecl>(D)->getInit()->isGLValue());
|
||||
!cast<OMPCapturedExprDecl>(D)->getInit()->isGLValue()) &&
|
||||
// If the variable is implicitly firstprivate and scalar - capture by
|
||||
// copy
|
||||
!(DSAStack->getDefaultDSA() == DSA_firstprivate &&
|
||||
!DSAStack->hasExplicitDSA(
|
||||
D, [](OpenMPClauseKind K) { return K != OMPC_unknown; }, Level) &&
|
||||
!DSAStack->isLoopControlVariable(D, Level).first);
|
||||
}
|
||||
|
||||
// When passing data by copy, we need to make sure it fits the uintptr size
|
||||
|
@ -2185,10 +2206,13 @@ VarDecl *Sema::isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo,
|
|||
DSAStack->isClauseParsingMode());
|
||||
// Global shared must not be captured.
|
||||
if (VD && !VD->hasLocalStorage() && DVarPrivate.CKind == OMPC_unknown &&
|
||||
(DSAStack->getDefaultDSA() != DSA_none || DVarTop.CKind == OMPC_shared))
|
||||
((DSAStack->getDefaultDSA() != DSA_none &&
|
||||
DSAStack->getDefaultDSA() != DSA_firstprivate) ||
|
||||
DVarTop.CKind == OMPC_shared))
|
||||
return nullptr;
|
||||
if (DVarPrivate.CKind != OMPC_unknown ||
|
||||
(VD && DSAStack->getDefaultDSA() == DSA_none))
|
||||
(VD && (DSAStack->getDefaultDSA() == DSA_none ||
|
||||
DSAStack->getDefaultDSA() == DSA_firstprivate)))
|
||||
return VD ? VD : cast<VarDecl>(DVarPrivate.PrivateCopy->getDecl());
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -3333,9 +3357,18 @@ public:
|
|||
// in the construct, and does not have a predetermined data-sharing
|
||||
// attribute, must have its data-sharing attribute explicitly determined
|
||||
// by being listed in a data-sharing attribute clause.
|
||||
if (DVar.CKind == OMPC_unknown && Stack->getDefaultDSA() == DSA_none &&
|
||||
if (DVar.CKind == OMPC_unknown &&
|
||||
(Stack->getDefaultDSA() == DSA_none ||
|
||||
Stack->getDefaultDSA() == DSA_firstprivate) &&
|
||||
isImplicitOrExplicitTaskingRegion(DKind) &&
|
||||
VarsWithInheritedDSA.count(VD) == 0) {
|
||||
bool InheritedDSA = Stack->getDefaultDSA() == DSA_none;
|
||||
if (!InheritedDSA && Stack->getDefaultDSA() == DSA_firstprivate) {
|
||||
DSAStackTy::DSAVarData DVar =
|
||||
Stack->getImplicitDSA(VD, /*FromParent=*/false);
|
||||
InheritedDSA = DVar.CKind == OMPC_unknown;
|
||||
}
|
||||
if (InheritedDSA)
|
||||
VarsWithInheritedDSA[VD] = E;
|
||||
return;
|
||||
}
|
||||
|
@ -3438,7 +3471,9 @@ public:
|
|||
|
||||
// Define implicit data-sharing attributes for task.
|
||||
DVar = Stack->getImplicitDSA(VD, /*FromParent=*/false);
|
||||
if (isOpenMPTaskingDirective(DKind) && DVar.CKind != OMPC_shared &&
|
||||
if (((isOpenMPTaskingDirective(DKind) && DVar.CKind != OMPC_shared) ||
|
||||
(Stack->getDefaultDSA() == DSA_firstprivate &&
|
||||
DVar.CKind == OMPC_firstprivate && !DVar.RefExpr)) &&
|
||||
!Stack->isLoopControlVariable(VD).first) {
|
||||
ImplicitFirstprivate.push_back(E);
|
||||
return;
|
||||
|
@ -5342,8 +5377,10 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
|
|||
|
||||
ErrorFound = Res.isInvalid() || ErrorFound;
|
||||
|
||||
// Check variables in the clauses if default(none) was specified.
|
||||
if (DSAStack->getDefaultDSA() == DSA_none) {
|
||||
// Check variables in the clauses if default(none) or
|
||||
// default(firstprivate) was specified.
|
||||
if (DSAStack->getDefaultDSA() == DSA_none ||
|
||||
DSAStack->getDefaultDSA() == DSA_firstprivate) {
|
||||
DSAAttrChecker DSAChecker(DSAStack, *this, nullptr);
|
||||
for (OMPClause *C : Clauses) {
|
||||
switch (C->getClauseKind()) {
|
||||
|
@ -5454,7 +5491,8 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
|
|||
if (P.getFirst()->isImplicit() || isa<OMPCapturedExprDecl>(P.getFirst()))
|
||||
continue;
|
||||
ErrorFound = true;
|
||||
if (DSAStack->getDefaultDSA() == DSA_none) {
|
||||
if (DSAStack->getDefaultDSA() == DSA_none ||
|
||||
DSAStack->getDefaultDSA() == DSA_firstprivate) {
|
||||
Diag(P.second->getExprLoc(), diag::err_omp_no_dsa_for_variable)
|
||||
<< P.first << P.second->getSourceRange();
|
||||
Diag(DSAStack->getDefaultDSALocation(), diag::note_omp_default_dsa_none);
|
||||
|
@ -12932,10 +12970,20 @@ OMPClause *Sema::ActOnOpenMPDefaultClause(DefaultKind Kind,
|
|||
<< getOpenMPClauseName(OMPC_default);
|
||||
return nullptr;
|
||||
}
|
||||
if (Kind == OMP_DEFAULT_none)
|
||||
|
||||
switch (Kind) {
|
||||
case OMP_DEFAULT_none:
|
||||
DSAStack->setDefaultDSANone(KindKwLoc);
|
||||
else if (Kind == OMP_DEFAULT_shared)
|
||||
break;
|
||||
case OMP_DEFAULT_shared:
|
||||
DSAStack->setDefaultDSAShared(KindKwLoc);
|
||||
break;
|
||||
case OMP_DEFAULT_firstprivate:
|
||||
DSAStack->setDefaultDSAFirstPrivate(KindKwLoc);
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("DSA unexpected in OpenMP default clause");
|
||||
}
|
||||
|
||||
return new (Context)
|
||||
OMPDefaultClause(Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
|
||||
|
|
|
@ -2,8 +2,17 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
template <class T, int N>
|
||||
T tmain(T argc) {
|
||||
int i;
|
||||
|
@ -14,12 +23,12 @@ T tmain(T argc) {
|
|||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp distribute parallel for default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp distribute parallel for default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
|
@ -34,7 +43,7 @@ T tmain(T argc) {
|
|||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp distribute parallel for default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
|
@ -62,12 +71,12 @@ int main(int argc, char **argv) {
|
|||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp distribute parallel for default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp distribute parallel for default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
|
@ -82,7 +91,7 @@ int main(int argc, char **argv) {
|
|||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp distribute parallel for default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
|
@ -98,5 +107,15 @@ int main(int argc, char **argv) {
|
|||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
#ifdef OMP51
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) {
|
||||
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
|
||||
return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain<int, 5>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<char, 1>' requested here}}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,17 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized -DOMP51 -fopenmp-version=51
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized -DOMP51 -fopenmp-version=51
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
template <class T, int N>
|
||||
T tmain(T argc) {
|
||||
int i;
|
||||
|
@ -14,12 +23,12 @@ T tmain(T argc) {
|
|||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp distribute parallel for simd default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp distribute parallel for simd default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
|
@ -34,7 +43,7 @@ T tmain(T argc) {
|
|||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp distribute parallel for simd default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
|
@ -62,12 +71,12 @@ int main(int argc, char **argv) {
|
|||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp distribute parallel for simd default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp distribute parallel for simd default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
|
@ -82,7 +91,7 @@ int main(int argc, char **argv) {
|
|||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp distribute parallel for simd default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target
|
||||
|
@ -90,6 +99,15 @@ int main(int argc, char **argv) {
|
|||
#pragma omp distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
#ifdef OpenMP51
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) {
|
||||
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
#pragma omp target
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
// RUN: %clang %s -c -E -dM -fopenmp-simd -fopenmp-version=31 | FileCheck --check-prefix=CHECK-VERSION %s
|
||||
// RUN: %clang %s -c -E -dM -fopenmp-simd -fopenmp-version=40 | FileCheck --check-prefix=CHECK-VERSION %s
|
||||
// RUN: %clang %s -c -E -dM -fopenmp-simd -fopenmp-version=45 | FileCheck --check-prefix=CHECK-VERSION %s
|
||||
// RUN: %clang %s -c -E -dM -fopenmp-simd -fopenmp-version=51 | FileCheck --check-prefix=CHECK-VERSION %s
|
||||
|
||||
// CHECK-VERSION-NOT: #define _OPENMP
|
||||
|
||||
|
|
|
@ -4,18 +4,25 @@
|
|||
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-version=40 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=31 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=30 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-version=51 -fopenmp -DOMP51 -ferror-limit 100 -o - %s -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-version=51 -fopenmp-simd -DOMP51 -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const int c = 0;
|
||||
|
||||
#pragma omp parallel default // expected-error {{expected '(' after 'default'}}
|
||||
#pragma omp parallel default ( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp parallel default () // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp parallel default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp parallel default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
#pragma omp parallel default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp parallel default(shared), default(shared) // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'default' clause}}
|
||||
#pragma omp parallel default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp parallel default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
|
||||
#pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
|
@ -27,5 +34,14 @@ int main(int argc, char **argv) {
|
|||
|
||||
#pragma omp parallel default(none) // ge40-note {{explicit data sharing attribute requested here}}
|
||||
(void)c; // ge40-error {{variable 'c' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#ifdef OMP51
|
||||
#pragma omp parallel default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
{
|
||||
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,17 +2,26 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -DOMP51 -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -DOMP51 -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
#pragma omp parallel for default // expected-error {{expected '(' after 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp parallel for default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp parallel for default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
|
||||
|
@ -21,7 +30,7 @@ int main(int argc, char **argv) {
|
|||
#pragma omp parallel for default(shared), default(shared) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'default' clause}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp parallel for default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
|
@ -34,5 +43,13 @@ int main(int argc, char **argv) {
|
|||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
#ifdef OMP51
|
||||
#pragma omp parallel for default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) {
|
||||
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,17 +2,26 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd -o - %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
#pragma omp parallel for simd default // expected-error {{expected '(' after 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp parallel for simd default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp parallel for simd default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
|
||||
|
@ -21,7 +30,7 @@ int main(int argc, char **argv) {
|
|||
#pragma omp parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'default' clause}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp parallel for simd default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
|
@ -34,5 +43,13 @@ int main(int argc, char **argv) {
|
|||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} expected-error {{variable 'i' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
#ifdef OMP51
|
||||
#pragma omp parallel for default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) {
|
||||
x++; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
y++; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -118,6 +118,162 @@ void parallel_master_private() {
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef CK31
|
||||
///==========================================================================///
|
||||
// RUN: %clang_cc1 -DCK31 -fopenmp-version=51 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s --check-prefix CK31
|
||||
// RUN: %clang_cc1 -DCK31 -fopenmp-version=51 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
|
||||
// RUN: %clang_cc1 -DCK31 -fopenmp-version=51 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK31
|
||||
|
||||
// RUN: %clang_cc1 -DCK31 -fopenmp-version=51 -verify -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
||||
// RUN: %clang_cc1 -DCK31 -fopenmp-version=51 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
|
||||
// RUN: %clang_cc1 -DCK31 -fopenmp-version=51 -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
||||
// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
|
||||
|
||||
// CK31-DAG: %struct.ident_t = type { i32, i32, i32, i32, i8* }
|
||||
// CK31-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00"
|
||||
|
||||
void parallel_master_default_firstprivate() {
|
||||
int a;
|
||||
#pragma omp parallel master default(firstprivate)
|
||||
a++;
|
||||
}
|
||||
|
||||
// CK31-LABEL: define void @{{.+}}parallel_master{{.+}}
|
||||
// CK31: [[A_VAL:%.+]] = alloca i32{{.+}}
|
||||
// CK31: [[A_CASTED:%.+]] = alloca i64
|
||||
// CK31: [[ZERO_VAL:%.+]] = load i32, i32* [[A_VAL]]
|
||||
// CK31: [[CONV:%.+]] = bitcast i64* [[A_CASTED]] to i32*
|
||||
// CK31: store i32 [[ZERO_VAL]], i32* [[CONV]]
|
||||
// CK31: [[ONE_VAL:%.+]] = load i64, i64* [[A_CASTED]]
|
||||
// CK31: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* @0, i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, i64)* @.omp_outlined. to void (i32*, i32*, ...)*), i64 [[ONE_VAL]])
|
||||
// CK31: ret void
|
||||
|
||||
// CK31: [[GLOBAL_TID_ADDR:%.+]] = alloca i32*
|
||||
// CK31: [[BOUND_TID_ADDR:%.+]] = alloca i32*
|
||||
// CK31: [[A_ADDR:%.+]] = alloca i64{{.+}}
|
||||
// CK31: store i32* [[GLOBAL_TID:%.+]], i32** [[GLOBAL_TID_ADDR]]{{.+}}
|
||||
// CK31: store i32* [[BOUND_TID:%.+]], i32** [[BOUND_TID_ADDR]]
|
||||
// CK31: store i64 [[A_VAL]], i64* [[A_ADDR]]
|
||||
// CK31: [[CONV]] = bitcast i64* [[A_ADDR]]
|
||||
// CK31: [[ZERO_VAL]] = load i32*, i32** [[GLOBAL_TID_ADDR]]
|
||||
// CK31: [[ONE_VAL]] = load i32, i32* [[ZERO_VAL]]
|
||||
// CK31: [[TWO_VAL:%.+]] = call i32 @__kmpc_master(%struct.ident_t* @0, i32 [[ONE_VAL]])
|
||||
// CK31: [[THREE:%.+]] = icmp ne i32 [[TWO_VAL]], 0
|
||||
// CK31: br i1 %3, label [[OMP_IF_THEN:%.+]], label [[OMP_IF_END:%.+]]
|
||||
|
||||
// CK31: [[FOUR:%.+]] = load i32, i32* [[CONV:%.+]]
|
||||
// CK31: [[INC:%.+]] = add nsw i32 [[FOUR]]
|
||||
// CK31: store i32 [[INC]], i32* [[CONV]]
|
||||
// CK31: call void @__kmpc_end_master(%struct.ident_t* @0, i32 [[ONE_VAL]])
|
||||
// CK31: br label [[OMP_IF_END]]
|
||||
|
||||
// CK31: ret void
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CK32
|
||||
///==========================================================================///
|
||||
// RUN: %clang_cc1 -DCK32 -fopenmp-version=51 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s --check-prefix CK32
|
||||
// RUN: %clang_cc1 -DCK32 -fopenmp-version=51 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
|
||||
// RUN: %clang_cc1 -DCK32 -fopenmp-version=51 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK32
|
||||
|
||||
// RUN: %clang_cc1 -DCK32 -fopenmp-version=51 -verify -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
||||
// RUN: %clang_cc1 -DCK32 -fopenmp-version=51 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
|
||||
// RUN: %clang_cc1 -DCK32 -fopenmp-version=51 -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
||||
// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
|
||||
|
||||
// CK32-DAG: %struct.ident_t = type { i32, i32, i32, i32, i8* }
|
||||
// CK32-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00"
|
||||
|
||||
struct St {
|
||||
int a, b;
|
||||
static int y;
|
||||
St() : a(0), b(0) {}
|
||||
~St() {}
|
||||
};
|
||||
int St::y = 0;
|
||||
|
||||
void parallel_master_default_firstprivate() {
|
||||
St a = St();
|
||||
static int y = 0;
|
||||
#pragma omp parallel master default(firstprivate)
|
||||
{
|
||||
a.a += 1;
|
||||
a.b += 1;
|
||||
y++;
|
||||
a.y++;
|
||||
}
|
||||
}
|
||||
|
||||
// CK32-LABEL: define {{.+}} @{{.+}}parallel_master_default_firstprivate{{.+}}
|
||||
// CK32: [[A_VAL:%.+]] = alloca %struct.St{{.+}}
|
||||
// CK32: [[Y_CASTED:%.+]] = alloca i64
|
||||
// CK32: call void @[[CTOR:.+]](%struct.St* [[A_VAL]])
|
||||
// CK32: [[ZERO:%.+]] = load i32, i32* @{{.+}}parallel_master_default_firstprivate{{.+}}
|
||||
// CK32: [[CONV:%.+]] = bitcast i64* [[Y_CASTED]] to i32*
|
||||
// CK32: store i32 [[ZERO]], i32* [[CONV]]
|
||||
// CK32: [[ONE:%.+]] = load i64, i64* [[Y_CASTED]]
|
||||
// CK32: call void {{.+}}@{{.+}} %struct.St* [[A_VAL]], i64 [[ONE]])
|
||||
// CK32: call void [[DTOR:@.+]](%struct.St* [[A_VAL]])
|
||||
|
||||
// CK32: [[THIS_ADDR:%.+]] = alloca %struct.St*
|
||||
// CK32: store %struct.St* [[THIS:%.+]], %struct.St** [[THIS_ADDR]]
|
||||
// CK32: [[THIS_ONE:%.+]] = load %struct.St*, %struct.St** [[THIS_ADDR]]
|
||||
// CK32: call void [[CTOR_2:.+]](%struct.St* [[THIS_ONE]])
|
||||
// CK32: ret void
|
||||
|
||||
// CK32: [[GLOBAL_TID_ADDR:%.+]] = alloca i32*
|
||||
// CK32: [[BOUND_TID_ADDR:%.+]] = alloca i32*
|
||||
// CK32: [[A_ADDR:%.+]] = alloca %struct.St
|
||||
// CK32: [[Y_ADDR:%.+]] = alloca i64
|
||||
// CK32: store i32* [[GLOBAL_TID:%.+]], i32** [[GLOBAL_TID_ADDR]]
|
||||
// CK32: store i32* %.bound_tid., i32** [[BOUND_TID_ADDR]]
|
||||
// CK32: store %struct.St* [[A_VAL]], %struct.St** [[A_ADDR]]{{.+}}
|
||||
// CK32: store i64 [[Y:%.+]], i64* [[Y_ADDR]]
|
||||
// CK32: [[ONE:%.+]] = load i32*, i32** [[GLOBAL_TID_ADDR]]
|
||||
// CK32: [[TWO:%.+]] = load i32, i32* [[ONE]]
|
||||
// CK32: [[THREE:%.+]] = call i32 @{{.+}} i32 [[TWO]])
|
||||
// CK32: [[FOUR:%.+]] = icmp ne i32 [[THREE]], 0
|
||||
// CK32: br i1 [[FOUR]], label [[IF_THEN:%.+]], label [[IF_END:%.+]]
|
||||
|
||||
// CK32: [[A_1:%.+]] = getelementptr inbounds %struct.St, %struct.St* [[ZERO]], i32 0, i32 0
|
||||
// CK32: [[FIVE:%.+]] = load i32, i32* [[A_1]]
|
||||
// CK32: [[ADD:%.+]] = add nsw i32 [[FIVE]], 1
|
||||
// CK32: store i32 [[ADD]], i32* [[A_1]]
|
||||
// CK32: [[B:%.+]] = getelementptr inbounds %struct.St, %struct.St* [[ZERO]], i32 0, i32 1
|
||||
// CK32: [[SIX:%.+]] = load i32, i32* [[B]]
|
||||
// CK32: [[ADD_2:%.+]] = add nsw i32 [[SIX]], 1
|
||||
// CK32: store i32 [[ADD_2]], i32* [[B]]
|
||||
// CK32: [[SEVEN:%.+]] = load i32, i32* [[CONV]]
|
||||
// CK32: [[INC:%.+]] = add nsw i32 [[SEVEN]], 1
|
||||
// CK32: store i32 [[INC]], i32* [[CONV]]
|
||||
// CK32: [[EIGHT:%.+]] = load i32, i32* [[FUNC:@.+]]
|
||||
// CK32: [[INC_3:%.+]] = add nsw i32 [[EIGHT]], 1
|
||||
// CK32: store i32 [[INC_3]], i32* @{{.+}}
|
||||
// CK32: call void @{{.+}} i32 [[TWO]])
|
||||
// CK32: br label [[IF_END]]
|
||||
|
||||
// CK32: [[DTOR]](%struct.St* [[THIS]])
|
||||
// CK32: [[THIS_ADDR]] = alloca %struct.St*
|
||||
// CK32: store %struct.St* [[THIS]], %struct.St** [[THIS_ADDR]]
|
||||
// CK32: [[THIS_ONE]] = load %struct.St*, %struct.St** [[THIS_ADDR]]
|
||||
// CK32: call void @_ZN2StD2Ev(%struct.St* [[THIS_ONE]])
|
||||
|
||||
// CK32: [[THIS_ADDR]] = alloca %struct.St*
|
||||
// CK32: store %struct.St* [[THIS]], %struct.St** [[THIS_ADDR]]
|
||||
// CK32: [[THIS_ONE]] = load %struct.St*, %struct.St** [[THIS_ADDR]]
|
||||
// CK32: [[A_VAL]] = getelementptr inbounds %struct.St, %struct.St* [[THIS_ONE]], i32 0, i32 0
|
||||
// CK32: store i32 0, i32* [[A_VAL]]
|
||||
// CK32: [[B_VAL:%.+]] = getelementptr inbounds %struct.St, %struct.St* [[THIS_ONE]], i32 0, i32 1
|
||||
// CK32: store i32 0, i32* [[B_VAL]]
|
||||
// CK32: ret void
|
||||
|
||||
// CK32: [[THIS_ADDR:%.+]] = alloca %struct.St*
|
||||
// CK32: store %struct.St* %this, %struct.St** [[THIS_ADDR]]
|
||||
// CK32: [[THIS_ONE]] = load %struct.St*, %struct.St** [[THIS_ADDR]]
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CK4
|
||||
///==========================================================================///
|
||||
// RUN: %clang_cc1 -DCK4 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s --check-prefix CK4
|
||||
|
|
|
@ -2,20 +2,29 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp parallel master default // expected-error {{expected '(' after 'default'}}
|
||||
{
|
||||
#pragma omp parallel master default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp parallel master default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
{
|
||||
#pragma omp parallel master default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp parallel master default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
{
|
||||
#pragma omp parallel master default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
{
|
||||
#pragma omp parallel master default(shared), default(shared) // expected-error {{directive '#pragma omp parallel master' cannot contain more than one 'default' clause}}
|
||||
{
|
||||
#pragma omp parallel master default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp parallel master default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
{
|
||||
foo();
|
||||
}
|
||||
|
@ -37,5 +46,14 @@ int main(int argc, char **argv) {
|
|||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef OMP51
|
||||
#pragma omp parallel master default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
{
|
||||
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7,15 +7,15 @@ void foo();
|
|||
int main(int argc, char **argv) {
|
||||
#pragma omp parallel sections default // expected-error {{expected '(' after 'default'}}
|
||||
{
|
||||
#pragma omp parallel sections default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp parallel sections default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
{
|
||||
#pragma omp parallel sections default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp parallel sections default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
{
|
||||
#pragma omp parallel sections default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
{
|
||||
#pragma omp parallel sections default(shared), default(shared) // expected-error {{directive '#pragma omp parallel sections' cannot contain more than one 'default' clause}}
|
||||
{
|
||||
#pragma omp parallel sections default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp parallel sections default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
{
|
||||
foo();
|
||||
}
|
||||
|
|
|
@ -2,20 +2,29 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp target parallel default // expected-error {{expected '(' after 'default'}}
|
||||
foo();
|
||||
#pragma omp target parallel default ( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp target parallel default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
foo();
|
||||
#pragma omp target parallel default () // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target parallel default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
#pragma omp target parallel default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
foo();
|
||||
#pragma omp target parallel default (shared), default(shared) // expected-error {{directive '#pragma omp target parallel' cannot contain more than one 'default' clause}}
|
||||
foo();
|
||||
#pragma omp target parallel default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target parallel default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
|
||||
#pragma omp target parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
|
@ -28,5 +37,14 @@ int main(int argc, char **argv) {
|
|||
#pragma omp target parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp parallel default(shared)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#ifndef OMP51
|
||||
#pragma omp target parallel default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}
|
||||
{
|
||||
++x;
|
||||
++y;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,17 +2,26 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -DOMP51 -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -DOMP51 -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
#pragma omp target parallel for default // expected-error {{expected '(' after 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target parallel for default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp target parallel for default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target parallel for default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target parallel for default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
|
||||
|
@ -21,7 +30,7 @@ int main(int argc, char **argv) {
|
|||
#pragma omp target parallel for default(shared), default(shared) // expected-error {{directive '#pragma omp target parallel for' cannot contain more than one 'default' clause}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target parallel for default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target parallel for default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
|
@ -34,5 +43,13 @@ int main(int argc, char **argv) {
|
|||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
#ifndef OMP51
|
||||
#pragma omp target parallel for default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}
|
||||
for (i = 0; i < argc; ++i) {
|
||||
++x;
|
||||
++y;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,17 +2,26 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
#pragma omp target parallel for simd default // expected-error {{expected '(' after 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target parallel for simd default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp target parallel for simd default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target parallel for simd default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
|
||||
|
@ -21,7 +30,7 @@ int main(int argc, char **argv) {
|
|||
#pragma omp target parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp target parallel for simd' cannot contain more than one 'default' clause}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target parallel for simd default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target parallel for simd default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
|
@ -34,5 +43,13 @@ int main(int argc, char **argv) {
|
|||
for (i = 0; i < argc; ++i) // expected-error {{variable 'i' must have explicitly specified data sharing attributes}} expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
#ifndef OMP51
|
||||
#pragma omp target parallel for simd default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}
|
||||
for (int i = 0; i < argc; i++) {
|
||||
++x;
|
||||
++y;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,20 +2,29 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd -o - %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp target teams default // expected-error {{expected '(' after 'default'}}
|
||||
foo();
|
||||
#pragma omp target teams default ( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp target teams default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
foo();
|
||||
#pragma omp target teams default () // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target teams default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
#pragma omp target teams default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
foo();
|
||||
#pragma omp target teams default (shared), default(shared) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'default' clause}}
|
||||
foo();
|
||||
#pragma omp target teams default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target teams default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
|
||||
#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
|
@ -24,5 +33,14 @@ int main(int argc, char **argv) {
|
|||
#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp parallel default(shared)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#ifndef OMP51
|
||||
#pragma omp target teams default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}
|
||||
{
|
||||
++x;
|
||||
++y;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,24 +2,41 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -DOMP51 %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -DOMP51 %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp target teams distribute default // expected-error {{expected '(' after 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target teams distribute default ( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp target teams distribute default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target teams distribute default () // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target teams distribute default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target teams distribute default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target teams distribute default (shared), default(shared) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'default' clause}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target teams distribute default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target teams distribute default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target teams distribute default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#ifndef OMP51
|
||||
#pragma omp target teams distribute default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}
|
||||
for (int i = 0; i < 200; i++) {
|
||||
++x;
|
||||
++y;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,24 +2,41 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp target teams distribute parallel for default // expected-error {{expected '(' after 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target teams distribute parallel for default ( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp target teams distribute parallel for default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target teams distribute parallel for default () // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target teams distribute parallel for default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target teams distribute parallel for default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target teams distribute parallel for default (shared), default(shared) // expected-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'default' clause}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target teams distribute parallel for default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target teams distribute parallel for default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#ifndef OMP51
|
||||
#pragma omp target teams distribute parallel for default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}
|
||||
for (int i = 0; i < 200; i++) {
|
||||
++x;
|
||||
++y;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,16 +2,25 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp target teams distribute parallel for simd default // expected-error {{expected '(' after 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target teams distribute parallel for simd default ( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp target teams distribute parallel for simd default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target teams distribute parallel for simd default () // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target teams distribute parallel for simd default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target teams distribute parallel for simd default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
|
@ -20,11 +29,19 @@ int main(int argc, char **argv) {
|
|||
#pragma omp target teams distribute parallel for simd default (shared), default(shared) // expected-error {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'default' clause}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target teams distribute parallel for simd default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp target teams distribute parallel for simd default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#ifndef OMP51
|
||||
#pragma omp target teams distribute parallel for simd default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
++x;
|
||||
++y;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,15 +2,24 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp task default // expected-error {{expected '(' after 'default'}}
|
||||
#pragma omp task default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp task default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp task default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp task default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
#pragma omp task default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp task default(shared), default(shared) // expected-error {{directive '#pragma omp task' cannot contain more than one 'default' clause}}
|
||||
#pragma omp task default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp task default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
|
||||
#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
|
@ -19,5 +28,13 @@ int main(int argc, char **argv) {
|
|||
#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp task default(shared)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#ifdef OMP51
|
||||
#pragma omp task default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
{
|
||||
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
// RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd -ferror-limit 200 -std=c++11 -o - %s -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd -ferror-limit 200 -std=c++11 -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=51 -DOMP51 -fopenmp -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=51 -DOMP51 -fopenmp-simd -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
|
||||
|
||||
void xxx(int argc) {
|
||||
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
|
||||
#pragma omp task
|
||||
|
@ -16,6 +19,10 @@ void foo() {
|
|||
}
|
||||
|
||||
typedef unsigned long omp_event_handle_t;
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
#pragma omp task // expected-error {{unexpected OpenMP directive '#pragma omp task'}}
|
||||
|
||||
|
@ -52,6 +59,15 @@ int foo() {
|
|||
#pragma omp task default(none) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
#pragma omp task default(shared)
|
||||
++a; // expected-error 2 {{variable 'a' must have explicitly specified data sharing attributes}}
|
||||
#ifdef OMP51
|
||||
#pragma omp task default(firstprivate) // expected-note 4 {{explicit data sharing attribute requested here}}
|
||||
#pragma omp task
|
||||
{
|
||||
++x; // expected-error 2 {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
++y; // expected-error 2 {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma omp task default(none) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
#pragma omp task
|
||||
// expected-error@+1 {{calling a private constructor of class 'S'}}
|
||||
|
|
|
@ -2,17 +2,26 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp -o - %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd -o - %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp target
|
||||
#pragma omp teams default // expected-error {{expected '(' after 'default'}}
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams default ( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp teams default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams default () // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp teams default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
|
@ -21,7 +30,7 @@ int main(int argc, char **argv) {
|
|||
#pragma omp teams default (shared), default(shared) // expected-error {{directive '#pragma omp teams' cannot contain more than one 'default' clause}}
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp teams default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
|
||||
#pragma omp target
|
||||
|
@ -32,5 +41,14 @@ int main(int argc, char **argv) {
|
|||
#pragma omp teams default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp parallel default(shared)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#ifdef OMP51
|
||||
#pragma omp target
|
||||
#pragma omp teams default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
{
|
||||
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,17 +2,26 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute default // expected-error {{expected '(' after 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute default ( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp teams distribute default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute default () // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp teams distribute default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
|
@ -21,12 +30,21 @@ int main(int argc, char **argv) {
|
|||
#pragma omp teams distribute default (shared), default(shared) // expected-error {{directive '#pragma omp teams distribute' cannot contain more than one 'default' clause}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp teams distribute default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#ifdef OMP51
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 200; i++) {
|
||||
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,17 +2,26 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd %s -Wuninitialized
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for default // expected-error {{expected '(' after 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for default ( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp teams distribute parallel for default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for default () // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp teams distribute parallel for default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
|
@ -21,12 +30,21 @@ int main(int argc, char **argv) {
|
|||
#pragma omp teams distribute parallel for default (shared), default(shared) // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'default' clause}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp teams distribute parallel for default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#ifdef OMP51
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 200; i++) {
|
||||
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,17 +2,26 @@
|
|||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized -fopenmp-version=51 -DOMP51
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized -fopenmp-version=51 -DOMP51
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for simd default // expected-error {{expected '(' after 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for simd default ( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp teams distribute parallel for simd default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for simd default () // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp teams distribute parallel for simd default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for simd default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
|
@ -21,12 +30,20 @@ int main(int argc, char **argv) {
|
|||
#pragma omp teams distribute parallel for simd default (shared), default(shared) // expected-error {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'default' clause}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for simd default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp teams distribute parallel for simd default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#ifdef OpenMP51
|
||||
#pragma omp teams distribute parallel for default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 200; i++) {
|
||||
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized -fopenmp-version=51
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized -fopenmp-version=51
|
||||
|
||||
void foo();
|
||||
|
||||
namespace {
|
||||
static int y = 0;
|
||||
}
|
||||
static int x = 0;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute simd default // expected-error {{expected '(' after 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute simd default ( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp teams distribute simd default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute simd default () // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp teams distribute simd default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute simd default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
|
@ -21,12 +26,22 @@ int main(int argc, char **argv) {
|
|||
#pragma omp teams distribute simd default (shared), default(shared) // expected-error {{directive '#pragma omp teams distribute simd' cannot contain more than one 'default' clause}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute simd default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
#pragma omp teams distribute simd default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute simd default(firstprivate) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 200; i++)
|
||||
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute simd default(firstprivate) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 200; i++)
|
||||
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -158,10 +158,10 @@ TEST_P(ASTMatchersTest,
|
|||
if (!GetParam().isCXX()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(notMatches("template<typename T> class X { };"
|
||||
EXPECT_TRUE(notMatches(
|
||||
"template<typename T> class X { };"
|
||||
"template<> class X<int> { int a; };",
|
||||
classTemplateDecl(hasName("X"),
|
||||
hasDescendant(fieldDecl(hasName("a"))))));
|
||||
classTemplateDecl(hasName("X"), hasDescendant(fieldDecl(hasName("a"))))));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest,
|
||||
|
@ -169,18 +169,17 @@ TEST_P(ASTMatchersTest,
|
|||
if (!GetParam().isCXX()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(notMatches("template<typename T, typename U> class X { };"
|
||||
EXPECT_TRUE(notMatches(
|
||||
"template<typename T, typename U> class X { };"
|
||||
"template<typename T> class X<T, int> { int a; };",
|
||||
classTemplateDecl(hasName("X"),
|
||||
hasDescendant(fieldDecl(hasName("a"))))));
|
||||
classTemplateDecl(hasName("X"), hasDescendant(fieldDecl(hasName("a"))))));
|
||||
}
|
||||
|
||||
TEST(ASTMatchersTestCUDA, CUDAKernelCallExpr) {
|
||||
EXPECT_TRUE(matchesWithCuda("__global__ void f() { }"
|
||||
"void g() { f<<<1, 2>>>(); }",
|
||||
cudaKernelCallExpr()));
|
||||
EXPECT_TRUE(notMatchesWithCuda("void f() {}",
|
||||
cudaKernelCallExpr()));
|
||||
EXPECT_TRUE(notMatchesWithCuda("void f() {}", cudaKernelCallExpr()));
|
||||
}
|
||||
|
||||
TEST(ASTMatchersTestCUDA, HasAttrCUDA) {
|
||||
|
@ -324,21 +323,16 @@ TEST_P(ASTMatchersTest, CallExpr_CXX) {
|
|||
StatementMatcher MethodOnY =
|
||||
cxxMemberCallExpr(on(hasType(recordDecl(hasName("Y")))));
|
||||
|
||||
EXPECT_TRUE(
|
||||
matches("class Y { public: void x(); }; void z() { Y y; y.x(); }",
|
||||
EXPECT_TRUE(matches("class Y { public: void x(); }; void z() { Y y; y.x(); }",
|
||||
MethodOnY));
|
||||
EXPECT_TRUE(
|
||||
matches("class Y { public: void x(); }; void z(Y &y) { y.x(); }",
|
||||
MethodOnY));
|
||||
EXPECT_TRUE(
|
||||
notMatches("class Y { public: void x(); }; void z(Y *&y) { y->x(); }",
|
||||
MethodOnY));
|
||||
EXPECT_TRUE(
|
||||
notMatches("class Y { public: void x(); }; void z(Y y[]) { y->x(); }",
|
||||
MethodOnY));
|
||||
EXPECT_TRUE(
|
||||
notMatches("class Y { public: void x(); }; void z() { Y *y; y->x(); }",
|
||||
EXPECT_TRUE(matches("class Y { public: void x(); }; void z(Y &y) { y.x(); }",
|
||||
MethodOnY));
|
||||
EXPECT_TRUE(notMatches(
|
||||
"class Y { public: void x(); }; void z(Y *&y) { y->x(); }", MethodOnY));
|
||||
EXPECT_TRUE(notMatches(
|
||||
"class Y { public: void x(); }; void z(Y y[]) { y->x(); }", MethodOnY));
|
||||
EXPECT_TRUE(notMatches(
|
||||
"class Y { public: void x(); }; void z() { Y *y; y->x(); }", MethodOnY));
|
||||
|
||||
StatementMatcher MethodOnYPointer =
|
||||
cxxMemberCallExpr(on(hasType(pointsTo(recordDecl(hasName("Y"))))));
|
||||
|
@ -364,8 +358,7 @@ TEST_P(ASTMatchersTest, LambdaExpr) {
|
|||
if (!GetParam().isCXX11OrLater()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(matches("auto f = [] (int i) { return i; };",
|
||||
lambdaExpr()));
|
||||
EXPECT_TRUE(matches("auto f = [] (int i) { return i; };", lambdaExpr()));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, CXXForRangeStmt) {
|
||||
|
@ -389,13 +382,11 @@ TEST_P(ASTMatchersTest, SubstNonTypeTemplateParmExpr) {
|
|||
EXPECT_FALSE(matches("template<int N>\n"
|
||||
"struct A { static const int n = 0; };\n"
|
||||
"struct B : public A<42> {};",
|
||||
traverse(TK_AsIs,
|
||||
substNonTypeTemplateParmExpr())));
|
||||
traverse(TK_AsIs, substNonTypeTemplateParmExpr())));
|
||||
EXPECT_TRUE(matches("template<int N>\n"
|
||||
"struct A { static const int n = N; };\n"
|
||||
"struct B : public A<42> {};",
|
||||
traverse(TK_AsIs,
|
||||
substNonTypeTemplateParmExpr())));
|
||||
traverse(TK_AsIs, substNonTypeTemplateParmExpr())));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, NonTypeTemplateParmDecl) {
|
||||
|
@ -414,8 +405,7 @@ TEST_P(ASTMatchersTest, TemplateTypeParmDecl) {
|
|||
}
|
||||
EXPECT_TRUE(matches("template <typename T> void f();",
|
||||
templateTypeParmDecl(hasName("T"))));
|
||||
EXPECT_TRUE(
|
||||
notMatches("template <int N> void f();", templateTypeParmDecl()));
|
||||
EXPECT_TRUE(notMatches("template <int N> void f();", templateTypeParmDecl()));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, UserDefinedLiteral) {
|
||||
|
@ -434,9 +424,7 @@ TEST_P(ASTMatchersTest, FlowControl) {
|
|||
EXPECT_TRUE(matches("void f() { while(1) { continue; } }", continueStmt()));
|
||||
EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}", gotoStmt()));
|
||||
EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}",
|
||||
labelStmt(
|
||||
hasDeclaration(
|
||||
labelDecl(hasName("FOO"))))));
|
||||
labelStmt(hasDeclaration(labelDecl(hasName("FOO"))))));
|
||||
EXPECT_TRUE(matches("void f() { FOO: ; void *ptr = &&FOO; goto *ptr; }",
|
||||
addrLabelExpr()));
|
||||
EXPECT_TRUE(matches("void f() { return; }", returnStmt()));
|
||||
|
@ -451,7 +439,8 @@ TEST_P(ASTMatchersTest, CXXOperatorCallExpr) {
|
|||
// Unary operator
|
||||
EXPECT_TRUE(matches("class Y { }; "
|
||||
"bool operator!(Y x) { return false; }; "
|
||||
"Y y; bool c = !y;", OpCall));
|
||||
"Y y; bool c = !y;",
|
||||
OpCall));
|
||||
// No match -- special operators like "new", "delete"
|
||||
// FIXME: operator new takes size_t, for which we need stddef.h, for which
|
||||
// we need to figure out include paths in the test.
|
||||
|
@ -461,7 +450,8 @@ TEST_P(ASTMatchersTest, CXXOperatorCallExpr) {
|
|||
// "Y *y = new Y;", OpCall));
|
||||
EXPECT_TRUE(notMatches("class Y { }; "
|
||||
"void operator delete(void *p) { } "
|
||||
"void a() {Y *y = new Y; delete y;}", OpCall));
|
||||
"void a() {Y *y = new Y; delete y;}",
|
||||
OpCall));
|
||||
// Binary operator
|
||||
EXPECT_TRUE(matches("class Y { }; "
|
||||
"bool operator&&(Y x, Y y) { return true; }; "
|
||||
|
@ -481,30 +471,25 @@ TEST_P(ASTMatchersTest, ThisPointerType) {
|
|||
traverse(ast_type_traits::TK_AsIs,
|
||||
cxxMemberCallExpr(thisPointerType(recordDecl(hasName("Y")))));
|
||||
|
||||
EXPECT_TRUE(
|
||||
matches("class Y { public: void x(); }; void z() { Y y; y.x(); }",
|
||||
EXPECT_TRUE(matches("class Y { public: void x(); }; void z() { Y y; y.x(); }",
|
||||
MethodOnY));
|
||||
EXPECT_TRUE(
|
||||
matches("class Y { public: void x(); }; void z(Y &y) { y.x(); }",
|
||||
EXPECT_TRUE(matches("class Y { public: void x(); }; void z(Y &y) { y.x(); }",
|
||||
MethodOnY));
|
||||
EXPECT_TRUE(
|
||||
matches("class Y { public: void x(); }; void z(Y *&y) { y->x(); }",
|
||||
MethodOnY));
|
||||
EXPECT_TRUE(
|
||||
matches("class Y { public: void x(); }; void z(Y y[]) { y->x(); }",
|
||||
MethodOnY));
|
||||
EXPECT_TRUE(
|
||||
matches("class Y { public: void x(); }; void z() { Y *y; y->x(); }",
|
||||
MethodOnY));
|
||||
|
||||
EXPECT_TRUE(matches(
|
||||
"class Y {"
|
||||
"class Y { public: void x(); }; void z(Y *&y) { y->x(); }", MethodOnY));
|
||||
EXPECT_TRUE(matches(
|
||||
"class Y { public: void x(); }; void z(Y y[]) { y->x(); }", MethodOnY));
|
||||
EXPECT_TRUE(matches(
|
||||
"class Y { public: void x(); }; void z() { Y *y; y->x(); }", MethodOnY));
|
||||
|
||||
EXPECT_TRUE(matches("class Y {"
|
||||
" public: virtual void x();"
|
||||
"};"
|
||||
"class X : public Y {"
|
||||
" public: virtual void x();"
|
||||
"};"
|
||||
"void z() { X *x; x->Y::x(); }", MethodOnY));
|
||||
"void z() { X *x; x->Y::x(); }",
|
||||
MethodOnY));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, DeclRefExpr) {
|
||||
|
@ -512,29 +497,27 @@ TEST_P(ASTMatchersTest, DeclRefExpr) {
|
|||
// FIXME: Add a test for `declRefExpr()` that does not depend on C++.
|
||||
return;
|
||||
}
|
||||
StatementMatcher Reference =
|
||||
declRefExpr(to(
|
||||
varDecl(hasInitializer(
|
||||
StatementMatcher Reference = declRefExpr(to(varDecl(hasInitializer(
|
||||
cxxMemberCallExpr(thisPointerType(recordDecl(hasName("Y"))))))));
|
||||
|
||||
EXPECT_TRUE(matches(
|
||||
"class Y {"
|
||||
EXPECT_TRUE(matches("class Y {"
|
||||
" public:"
|
||||
" bool x() const;"
|
||||
"};"
|
||||
"void z(const Y &y) {"
|
||||
" bool b = y.x();"
|
||||
" if (b) {}"
|
||||
"}", Reference));
|
||||
"}",
|
||||
Reference));
|
||||
|
||||
EXPECT_TRUE(notMatches(
|
||||
"class Y {"
|
||||
EXPECT_TRUE(notMatches("class Y {"
|
||||
" public:"
|
||||
" bool x() const;"
|
||||
"};"
|
||||
"void z(const Y &y) {"
|
||||
" bool b = y.x();"
|
||||
"}", Reference));
|
||||
"}",
|
||||
Reference));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, CXXMemberCallExpr) {
|
||||
|
@ -544,16 +527,16 @@ TEST_P(ASTMatchersTest, CXXMemberCallExpr) {
|
|||
StatementMatcher CallOnVariableY =
|
||||
cxxMemberCallExpr(on(declRefExpr(to(varDecl(hasName("y"))))));
|
||||
|
||||
EXPECT_TRUE(matches(
|
||||
"class Y { public: void x() { Y y; y.x(); } };", CallOnVariableY));
|
||||
EXPECT_TRUE(matches(
|
||||
"class Y { public: void x() const { Y y; y.x(); } };", CallOnVariableY));
|
||||
EXPECT_TRUE(matches(
|
||||
"class Y { public: void x(); };"
|
||||
"class X : public Y { void z() { X y; y.x(); } };", CallOnVariableY));
|
||||
EXPECT_TRUE(matches(
|
||||
"class Y { public: void x(); };"
|
||||
"class X : public Y { void z() { X *y; y->x(); } };", CallOnVariableY));
|
||||
EXPECT_TRUE(matches("class Y { public: void x() { Y y; y.x(); } };",
|
||||
CallOnVariableY));
|
||||
EXPECT_TRUE(matches("class Y { public: void x() const { Y y; y.x(); } };",
|
||||
CallOnVariableY));
|
||||
EXPECT_TRUE(matches("class Y { public: void x(); };"
|
||||
"class X : public Y { void z() { X y; y.x(); } };",
|
||||
CallOnVariableY));
|
||||
EXPECT_TRUE(matches("class Y { public: void x(); };"
|
||||
"class X : public Y { void z() { X *y; y->x(); } };",
|
||||
CallOnVariableY));
|
||||
EXPECT_TRUE(notMatches(
|
||||
"class Y { public: void x(); };"
|
||||
"class X : public Y { void z() { unsigned long y; ((X*)y)->x(); } };",
|
||||
|
@ -561,13 +544,13 @@ TEST_P(ASTMatchersTest, CXXMemberCallExpr) {
|
|||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, UnaryExprOrTypeTraitExpr) {
|
||||
EXPECT_TRUE(matches("void x() { int a = sizeof(a); }",
|
||||
unaryExprOrTypeTraitExpr()));
|
||||
EXPECT_TRUE(
|
||||
matches("void x() { int a = sizeof(a); }", unaryExprOrTypeTraitExpr()));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, AlignOfExpr) {
|
||||
EXPECT_TRUE(notMatches("void x() { int a = sizeof(a); }",
|
||||
alignOfExpr(anything())));
|
||||
EXPECT_TRUE(
|
||||
notMatches("void x() { int a = sizeof(a); }", alignOfExpr(anything())));
|
||||
// FIXME: Uncomment once alignof is enabled.
|
||||
// EXPECT_TRUE(matches("void x() { int a = alignof(a); }",
|
||||
// unaryExprOrTypeTraitExpr()));
|
||||
|
@ -604,8 +587,7 @@ TEST_P(ASTMatchersTest, MemberExpr_MatchesVariable) {
|
|||
}
|
||||
EXPECT_TRUE(
|
||||
matches("class Y { void x() { this->y; } int y; };", memberExpr()));
|
||||
EXPECT_TRUE(
|
||||
matches("class Y { void x() { y; } int y; };", memberExpr()));
|
||||
EXPECT_TRUE(matches("class Y { void x() { y; } int y; };", memberExpr()));
|
||||
EXPECT_TRUE(
|
||||
matches("class Y { void x() { Y y; y.y; } int y; };", memberExpr()));
|
||||
EXPECT_TRUE(matches("template <class T>"
|
||||
|
@ -623,8 +605,8 @@ TEST_P(ASTMatchersTest, MemberExpr_MatchesStaticVariable) {
|
|||
}
|
||||
EXPECT_TRUE(matches("class Y { void x() { this->y; } static int y; };",
|
||||
memberExpr()));
|
||||
EXPECT_TRUE(notMatches("class Y { void x() { y; } static int y; };",
|
||||
memberExpr()));
|
||||
EXPECT_TRUE(
|
||||
notMatches("class Y { void x() { y; } static int y; };", memberExpr()));
|
||||
EXPECT_TRUE(notMatches("class Y { void x() { Y::y; } static int y; };",
|
||||
memberExpr()));
|
||||
}
|
||||
|
@ -658,8 +640,8 @@ TEST_P(ASTMatchersTest, FunctionDecl_CXX) {
|
|||
if (!GetParam().hasDelayedTemplateParsing()) {
|
||||
// FIXME: Fix this test to work with delayed template parsing.
|
||||
// Dependent contexts, but a non-dependent call.
|
||||
EXPECT_TRUE(matches("void f(); template <int N> void g() { f(); }",
|
||||
CallFunctionF));
|
||||
EXPECT_TRUE(
|
||||
matches("void f(); template <int N> void g() { f(); }", CallFunctionF));
|
||||
EXPECT_TRUE(
|
||||
matches("void f(); template <int N> struct S { void g() { f(); } };",
|
||||
CallFunctionF));
|
||||
|
@ -692,8 +674,7 @@ TEST_P(ASTMatchersTest,
|
|||
if (!GetParam().isCXX()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(
|
||||
matches("template <typename T> void f(T t) {}",
|
||||
EXPECT_TRUE(matches("template <typename T> void f(T t) {}",
|
||||
functionTemplateDecl(hasName("f"))));
|
||||
}
|
||||
|
||||
|
@ -709,11 +690,10 @@ TEST_P(ASTMatchersTest,
|
|||
if (!GetParam().isCXX()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(
|
||||
notMatches("void g(); template <typename T> void f(T t) {}"
|
||||
EXPECT_TRUE(notMatches(
|
||||
"void g(); template <typename T> void f(T t) {}"
|
||||
"template <> void f(int t) { g(); }",
|
||||
functionTemplateDecl(hasName("f"),
|
||||
hasDescendant(declRefExpr(to(
|
||||
functionTemplateDecl(hasName("f"), hasDescendant(declRefExpr(to(
|
||||
functionDecl(hasName("g"))))))));
|
||||
}
|
||||
|
||||
|
@ -757,11 +737,9 @@ TEST_P(ASTMatchersTest, Matcher_ConstructorCall) {
|
|||
|
||||
EXPECT_TRUE(
|
||||
matches("class X { public: X(); }; void x() { X x; }", Constructor));
|
||||
EXPECT_TRUE(
|
||||
matches("class X { public: X(); }; void x() { X x = X(); }",
|
||||
EXPECT_TRUE(matches("class X { public: X(); }; void x() { X x = X(); }",
|
||||
Constructor));
|
||||
EXPECT_TRUE(
|
||||
matches("class X { public: X(int); }; void x() { X x = 0; }",
|
||||
EXPECT_TRUE(matches("class X { public: X(int); }; void x() { X x = 0; }",
|
||||
Constructor));
|
||||
EXPECT_TRUE(matches("class X {}; void x(int) { X x; }", Constructor));
|
||||
}
|
||||
|
@ -794,15 +772,13 @@ TEST_P(ASTMatchersTest, Matcher_BindTemporaryExpression) {
|
|||
|
||||
StringRef ClassString = "class string { public: string(); ~string(); }; ";
|
||||
|
||||
EXPECT_TRUE(
|
||||
matches(ClassString +
|
||||
"string GetStringByValue();"
|
||||
EXPECT_TRUE(matches(
|
||||
ClassString + "string GetStringByValue();"
|
||||
"void FunctionTakesString(string s);"
|
||||
"void run() { FunctionTakesString(GetStringByValue()); }",
|
||||
TempExpression));
|
||||
|
||||
EXPECT_TRUE(
|
||||
notMatches(ClassString +
|
||||
EXPECT_TRUE(notMatches(ClassString +
|
||||
"string* GetStringPointer(); "
|
||||
"void FunctionTakesStringPtr(string* s);"
|
||||
"void run() {"
|
||||
|
@ -812,8 +788,7 @@ TEST_P(ASTMatchersTest, Matcher_BindTemporaryExpression) {
|
|||
"}",
|
||||
TempExpression));
|
||||
|
||||
EXPECT_TRUE(
|
||||
notMatches("class no_dtor {};"
|
||||
EXPECT_TRUE(notMatches("class no_dtor {};"
|
||||
"no_dtor GetObjByValue();"
|
||||
"void ConsumeObj(no_dtor param);"
|
||||
"void run() { ConsumeObj(GetObjByValue()); }",
|
||||
|
@ -872,8 +847,7 @@ TEST_P(ASTMatchersTest, Matcher_NewExpression) {
|
|||
StatementMatcher New = cxxNewExpr();
|
||||
|
||||
EXPECT_TRUE(matches("class X { public: X(); }; void x() { new X; }", New));
|
||||
EXPECT_TRUE(
|
||||
matches("class X { public: X(); }; void x() { new X(); }", New));
|
||||
EXPECT_TRUE(matches("class X { public: X(); }; void x() { new X(); }", New));
|
||||
EXPECT_TRUE(
|
||||
matches("class X { public: X(int); }; void x() { new X(0); }", New));
|
||||
EXPECT_TRUE(matches("class X {}; void x(int) { new X; }", New));
|
||||
|
@ -883,8 +857,8 @@ TEST_P(ASTMatchersTest, Matcher_DeleteExpression) {
|
|||
if (!GetParam().isCXX()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(matches("struct A {}; void f(A* a) { delete a; }",
|
||||
cxxDeleteExpr()));
|
||||
EXPECT_TRUE(
|
||||
matches("struct A {}; void f(A* a) { delete a; }", cxxDeleteExpr()));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, Matcher_NoexceptExpression) {
|
||||
|
@ -1064,8 +1038,7 @@ TEST_P(ASTMatchersTest, StmtExpr) {
|
|||
TEST_P(ASTMatchersTest, PredefinedExpr) {
|
||||
// __func__ expands as StringLiteral("foo")
|
||||
EXPECT_TRUE(matches("void foo() { __func__; }",
|
||||
predefinedExpr(
|
||||
hasType(asString("const char [4]")),
|
||||
predefinedExpr(hasType(asString("const char [4]")),
|
||||
has(stringLiteral()))));
|
||||
}
|
||||
|
||||
|
@ -1096,16 +1069,16 @@ TEST_P(ASTMatchersTest, ConditionalOperator) {
|
|||
return;
|
||||
}
|
||||
|
||||
StatementMatcher Conditional = conditionalOperator(
|
||||
hasCondition(cxxBoolLiteral(equals(true))),
|
||||
StatementMatcher Conditional =
|
||||
conditionalOperator(hasCondition(cxxBoolLiteral(equals(true))),
|
||||
hasTrueExpression(cxxBoolLiteral(equals(false))));
|
||||
|
||||
EXPECT_TRUE(matches("void x() { true ? false : true; }", Conditional));
|
||||
EXPECT_TRUE(notMatches("void x() { false ? false : true; }", Conditional));
|
||||
EXPECT_TRUE(notMatches("void x() { true ? true : false; }", Conditional));
|
||||
|
||||
StatementMatcher ConditionalFalse = conditionalOperator(
|
||||
hasFalseExpression(cxxBoolLiteral(equals(false))));
|
||||
StatementMatcher ConditionalFalse =
|
||||
conditionalOperator(hasFalseExpression(cxxBoolLiteral(equals(false))));
|
||||
|
||||
EXPECT_TRUE(matches("void x() { true ? true : false; }", ConditionalFalse));
|
||||
EXPECT_TRUE(
|
||||
|
@ -1132,18 +1105,17 @@ TEST_P(ASTMatchersTest, BinaryConditionalOperator) {
|
|||
EXPECT_TRUE(matches("void x() { 1 ?: 0; }", AlwaysOne));
|
||||
|
||||
StatementMatcher FourNotFive = binaryConditionalOperator(
|
||||
hasTrueExpression(opaqueValueExpr(
|
||||
hasSourceExpression((integerLiteral(equals(4)))))),
|
||||
hasTrueExpression(
|
||||
opaqueValueExpr(hasSourceExpression((integerLiteral(equals(4)))))),
|
||||
hasFalseExpression(integerLiteral(equals(5))));
|
||||
|
||||
EXPECT_TRUE(matches("void x() { 4 ?: 5; }", FourNotFive));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, ArraySubscriptExpr) {
|
||||
EXPECT_TRUE(matches("int i[2]; void f() { i[1] = 1; }",
|
||||
arraySubscriptExpr()));
|
||||
EXPECT_TRUE(notMatches("int i; void f() { i = 1; }",
|
||||
arraySubscriptExpr()));
|
||||
EXPECT_TRUE(
|
||||
matches("int i[2]; void f() { i[1] = 1; }", arraySubscriptExpr()));
|
||||
EXPECT_TRUE(notMatches("int i; void f() { i = 1; }", arraySubscriptExpr()));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, ForStmt) {
|
||||
|
@ -1178,10 +1150,9 @@ TEST_P(ASTMatchersTest, CompoundStatement_DoesNotMatchEmptyStruct) {
|
|||
}
|
||||
// It's not a compound statement just because there's "{}" in the source
|
||||
// text. This is an AST search, not grep.
|
||||
EXPECT_TRUE(notMatches("namespace n { struct S {}; }",
|
||||
compoundStmt()));
|
||||
EXPECT_TRUE(matches("namespace n { struct S { void f() {{}} }; }",
|
||||
compoundStmt()));
|
||||
EXPECT_TRUE(notMatches("namespace n { struct S {}; }", compoundStmt()));
|
||||
EXPECT_TRUE(
|
||||
matches("namespace n { struct S { void f() {{}} }; }", compoundStmt()));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, CastExpr_MatchesExplicitCasts) {
|
||||
|
@ -1264,8 +1235,7 @@ TEST_P(ASTMatchersTest, CXXFunctionalCastExpr_DoesNotMatchOtherCasts) {
|
|||
EXPECT_TRUE(
|
||||
notMatches(FooClass + "void r() { Foo f = (Foo) \"hello world\"; }",
|
||||
cxxFunctionalCastExpr()));
|
||||
EXPECT_TRUE(
|
||||
notMatches(FooClass + "void r() { Foo f = \"hello world\"; }",
|
||||
EXPECT_TRUE(notMatches(FooClass + "void r() { Foo f = \"hello world\"; }",
|
||||
cxxFunctionalCastExpr()));
|
||||
}
|
||||
|
||||
|
@ -1283,8 +1253,7 @@ TEST_P(ASTMatchersTest, CXXStaticCastExpr_MatchesSimpleCase) {
|
|||
if (!GetParam().isCXX()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(matches("void* p(static_cast<void*>(&p));",
|
||||
cxxStaticCastExpr()));
|
||||
EXPECT_TRUE(matches("void* p(static_cast<void*>(&p));", cxxStaticCastExpr()));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, CXXStaticCastExpr_DoesNotMatchOtherCasts) {
|
||||
|
@ -1292,8 +1261,8 @@ TEST_P(ASTMatchersTest, CXXStaticCastExpr_DoesNotMatchOtherCasts) {
|
|||
return;
|
||||
}
|
||||
EXPECT_TRUE(notMatches("char* p = (char*)(&p);", cxxStaticCastExpr()));
|
||||
EXPECT_TRUE(notMatches("char q, *p = const_cast<char*>(&q);",
|
||||
cxxStaticCastExpr()));
|
||||
EXPECT_TRUE(
|
||||
notMatches("char q, *p = const_cast<char*>(&q);", cxxStaticCastExpr()));
|
||||
EXPECT_TRUE(notMatches("void* p = reinterpret_cast<char*>(&p);",
|
||||
cxxStaticCastExpr()));
|
||||
EXPECT_TRUE(notMatches("struct B { virtual ~B() {} }; struct D : B {};"
|
||||
|
@ -1335,12 +1304,12 @@ TEST_P(ASTMatchersTest, ImplicitCastExpr_MatchesSimpleCase) {
|
|||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, ImplicitCastExpr_DoesNotMatchIncorrectly) {
|
||||
// This test verifies that implicitCastExpr() matches exactly when implicit casts
|
||||
// are present, and that it ignores explicit and paren casts.
|
||||
// This test verifies that implicitCastExpr() matches exactly when implicit
|
||||
// casts are present, and that it ignores explicit and paren casts.
|
||||
|
||||
// These two test cases have no casts.
|
||||
EXPECT_TRUE(notMatches("int x = 0;",
|
||||
varDecl(hasInitializer(implicitCastExpr()))));
|
||||
EXPECT_TRUE(
|
||||
notMatches("int x = 0;", varDecl(hasInitializer(implicitCastExpr()))));
|
||||
EXPECT_TRUE(
|
||||
notMatches("int x = (0);", varDecl(hasInitializer(implicitCastExpr()))));
|
||||
EXPECT_TRUE(notMatches("void f() { int x = 0; double d = (double) x; }",
|
||||
|
@ -1441,8 +1410,7 @@ TEST_P(ASTMatchersTest, UsingDecl_MatchesUsingDeclarations) {
|
|||
if (!GetParam().isCXX()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(matches("namespace X { int x; } using X::x;",
|
||||
usingDecl()));
|
||||
EXPECT_TRUE(matches("namespace X { int x; } using X::x;", usingDecl()));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, UsingDecl_MatchesShadowUsingDelcarations) {
|
||||
|
@ -1500,10 +1468,10 @@ TEST_P(ASTMatchersTest, CxxExceptionHandling_SimpleCases) {
|
|||
EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", cxxTryStmt()));
|
||||
EXPECT_TRUE(
|
||||
notMatches("void foo() try { } catch(int X) { }", cxxThrowExpr()));
|
||||
EXPECT_TRUE(matches("void foo() try { throw; } catch(int X) { }",
|
||||
cxxThrowExpr()));
|
||||
EXPECT_TRUE(matches("void foo() try { throw 5;} catch(int X) { }",
|
||||
cxxThrowExpr()));
|
||||
EXPECT_TRUE(
|
||||
matches("void foo() try { throw; } catch(int X) { }", cxxThrowExpr()));
|
||||
EXPECT_TRUE(
|
||||
matches("void foo() try { throw 5;} catch(int X) { }", cxxThrowExpr()));
|
||||
EXPECT_TRUE(matches("void foo() try { throw; } catch(...) { }",
|
||||
cxxCatchStmt(isCatchAll())));
|
||||
EXPECT_TRUE(notMatches("void foo() try { throw; } catch(int) { }",
|
||||
|
@ -1542,8 +1510,7 @@ TEST_P(ASTMatchersTest, QualType) {
|
|||
|
||||
TEST_P(ASTMatchersTest, ConstantArrayType) {
|
||||
EXPECT_TRUE(matches("int a[2];", constantArrayType()));
|
||||
EXPECT_TRUE(notMatches(
|
||||
"void f() { int a[] = { 2, 3 }; int b[a[0]]; }",
|
||||
EXPECT_TRUE(notMatches("void f() { int a[] = { 2, 3 }; int b[a[0]]; }",
|
||||
constantArrayType(hasElementType(builtinType()))));
|
||||
|
||||
EXPECT_TRUE(matches("int a[42];", constantArrayType(hasSize(42))));
|
||||
|
@ -1555,11 +1522,11 @@ TEST_P(ASTMatchersTest, DependentSizedArrayType) {
|
|||
if (!GetParam().isCXX()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(matches(
|
||||
"template <typename T, int Size> class array { T data[Size]; };",
|
||||
EXPECT_TRUE(
|
||||
matches("template <typename T, int Size> class array { T data[Size]; };",
|
||||
dependentSizedArrayType()));
|
||||
EXPECT_TRUE(notMatches(
|
||||
"int a[42]; int b[] = { 2, 3 }; void f() { int c[b[0]]; }",
|
||||
EXPECT_TRUE(
|
||||
notMatches("int a[42]; int b[] = { 2, 3 }; void f() { int c[b[0]]; }",
|
||||
dependentSizedArrayType()));
|
||||
}
|
||||
|
||||
|
@ -1575,10 +1542,9 @@ TEST_P(ASTMatchersTest, VariableArrayType) {
|
|||
EXPECT_TRUE(matches("void f(int b) { int a[b]; }", variableArrayType()));
|
||||
EXPECT_TRUE(notMatches("int a[] = {2, 3}; int b[42];", variableArrayType()));
|
||||
|
||||
EXPECT_TRUE(matches(
|
||||
"void f(int b) { int a[b]; }",
|
||||
variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
|
||||
varDecl(hasName("b")))))))));
|
||||
EXPECT_TRUE(matches("void f(int b) { int a[b]; }",
|
||||
variableArrayType(hasSizeExpr(ignoringImpCasts(
|
||||
declRefExpr(to(varDecl(hasName("b")))))))));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, AtomicType) {
|
||||
|
@ -1587,10 +1553,10 @@ TEST_P(ASTMatchersTest, AtomicType) {
|
|||
// FIXME: Make this work for MSVC.
|
||||
EXPECT_TRUE(matches("_Atomic(int) i;", atomicType()));
|
||||
|
||||
EXPECT_TRUE(matches("_Atomic(int) i;",
|
||||
atomicType(hasValueType(isInteger()))));
|
||||
EXPECT_TRUE(notMatches("_Atomic(float) f;",
|
||||
atomicType(hasValueType(isInteger()))));
|
||||
EXPECT_TRUE(
|
||||
matches("_Atomic(int) i;", atomicType(hasValueType(isInteger()))));
|
||||
EXPECT_TRUE(
|
||||
notMatches("_Atomic(float) f;", atomicType(hasValueType(isInteger()))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1680,25 +1646,20 @@ TEST_P(ASTMatchersTest, PointerType) {
|
|||
// "int* a;",
|
||||
// pointerTypeLoc().bind("loc"),
|
||||
// std::make_unique<VerifyIdIsBoundTo<TypeLoc>>("loc", 1)));
|
||||
EXPECT_TRUE(matches(
|
||||
"int** a;",
|
||||
loc(pointerType(pointee(qualType())))));
|
||||
EXPECT_TRUE(matches(
|
||||
"int** a;",
|
||||
loc(pointerType(pointee(pointerType())))));
|
||||
EXPECT_TRUE(matches(
|
||||
"int* b; int* * const a = &b;",
|
||||
EXPECT_TRUE(matches("int** a;", loc(pointerType(pointee(qualType())))));
|
||||
EXPECT_TRUE(matches("int** a;", loc(pointerType(pointee(pointerType())))));
|
||||
EXPECT_TRUE(matches("int* b; int* * const a = &b;",
|
||||
loc(qualType(isConstQualified(), pointerType()))));
|
||||
|
||||
StringRef Fragment = "int *ptr;";
|
||||
EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
|
||||
hasType(blockPointerType()))));
|
||||
EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
|
||||
hasType(memberPointerType()))));
|
||||
EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"),
|
||||
hasType(pointerType()))));
|
||||
EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
|
||||
hasType(referenceType()))));
|
||||
EXPECT_TRUE(notMatches(Fragment,
|
||||
varDecl(hasName("ptr"), hasType(blockPointerType()))));
|
||||
EXPECT_TRUE(notMatches(
|
||||
Fragment, varDecl(hasName("ptr"), hasType(memberPointerType()))));
|
||||
EXPECT_TRUE(
|
||||
matches(Fragment, varDecl(hasName("ptr"), hasType(pointerType()))));
|
||||
EXPECT_TRUE(
|
||||
notMatches(Fragment, varDecl(hasName("ptr"), hasType(referenceType()))));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, PointerType_CXX) {
|
||||
|
@ -1763,28 +1724,28 @@ TEST_P(ASTMatchersTest, AutoRefTypes) {
|
|||
"auto &c = a;"
|
||||
"auto &&d = c;"
|
||||
"auto &&e = 2;";
|
||||
EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("a"),
|
||||
hasType(referenceType()))));
|
||||
EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("b"),
|
||||
hasType(referenceType()))));
|
||||
EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
|
||||
hasType(referenceType()))));
|
||||
EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
|
||||
hasType(lValueReferenceType()))));
|
||||
EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("c"),
|
||||
hasType(rValueReferenceType()))));
|
||||
EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
|
||||
hasType(referenceType()))));
|
||||
EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
|
||||
hasType(lValueReferenceType()))));
|
||||
EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("d"),
|
||||
hasType(rValueReferenceType()))));
|
||||
EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
|
||||
hasType(referenceType()))));
|
||||
EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("e"),
|
||||
hasType(lValueReferenceType()))));
|
||||
EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
|
||||
hasType(rValueReferenceType()))));
|
||||
EXPECT_TRUE(
|
||||
notMatches(Fragment, varDecl(hasName("a"), hasType(referenceType()))));
|
||||
EXPECT_TRUE(
|
||||
notMatches(Fragment, varDecl(hasName("b"), hasType(referenceType()))));
|
||||
EXPECT_TRUE(
|
||||
matches(Fragment, varDecl(hasName("c"), hasType(referenceType()))));
|
||||
EXPECT_TRUE(
|
||||
matches(Fragment, varDecl(hasName("c"), hasType(lValueReferenceType()))));
|
||||
EXPECT_TRUE(notMatches(
|
||||
Fragment, varDecl(hasName("c"), hasType(rValueReferenceType()))));
|
||||
EXPECT_TRUE(
|
||||
matches(Fragment, varDecl(hasName("d"), hasType(referenceType()))));
|
||||
EXPECT_TRUE(
|
||||
matches(Fragment, varDecl(hasName("d"), hasType(lValueReferenceType()))));
|
||||
EXPECT_TRUE(notMatches(
|
||||
Fragment, varDecl(hasName("d"), hasType(rValueReferenceType()))));
|
||||
EXPECT_TRUE(
|
||||
matches(Fragment, varDecl(hasName("e"), hasType(referenceType()))));
|
||||
EXPECT_TRUE(notMatches(
|
||||
Fragment, varDecl(hasName("e"), hasType(lValueReferenceType()))));
|
||||
EXPECT_TRUE(
|
||||
matches(Fragment, varDecl(hasName("e"), hasType(rValueReferenceType()))));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, EnumType) {
|
||||
|
@ -1796,34 +1757,29 @@ TEST_P(ASTMatchersTest, EnumType_CXX) {
|
|||
if (!GetParam().isCXX()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(matches("enum Color { Green }; Color color;",
|
||||
loc(enumType())));
|
||||
EXPECT_TRUE(matches("enum Color { Green }; Color color;", loc(enumType())));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, EnumType_CXX11) {
|
||||
if (!GetParam().isCXX11OrLater()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(matches("enum class Color { Green }; Color color;",
|
||||
loc(enumType())));
|
||||
EXPECT_TRUE(
|
||||
matches("enum class Color { Green }; Color color;", loc(enumType())));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, PointerType_MatchesPointersToConstTypes) {
|
||||
EXPECT_TRUE(matches("int b; int * const a = &b;",
|
||||
loc(pointerType())));
|
||||
EXPECT_TRUE(matches("int b; int * const a = &b;",
|
||||
loc(pointerType())));
|
||||
EXPECT_TRUE(matches(
|
||||
"int b; const int * a = &b;",
|
||||
EXPECT_TRUE(matches("int b; int * const a = &b;", loc(pointerType())));
|
||||
EXPECT_TRUE(matches("int b; int * const a = &b;", loc(pointerType())));
|
||||
EXPECT_TRUE(matches("int b; const int * a = &b;",
|
||||
loc(pointerType(pointee(builtinType())))));
|
||||
EXPECT_TRUE(matches(
|
||||
"int b; const int * a = &b;",
|
||||
EXPECT_TRUE(matches("int b; const int * a = &b;",
|
||||
pointerType(pointee(builtinType()))));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, TypedefType) {
|
||||
EXPECT_TRUE(matches("typedef int X; X a;", varDecl(hasName("a"),
|
||||
hasType(typedefType()))));
|
||||
EXPECT_TRUE(matches("typedef int X; X a;",
|
||||
varDecl(hasName("a"), hasType(typedefType()))));
|
||||
}
|
||||
|
||||
TEST_P(ASTMatchersTest, TemplateSpecializationType) {
|
||||
|
@ -1864,13 +1820,13 @@ TEST_P(ASTMatchersTest, ElaboratedType) {
|
|||
// FIXME: Add a test for `elaboratedType()` that does not depend on C++.
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(matches(
|
||||
"namespace N {"
|
||||
EXPECT_TRUE(matches("namespace N {"
|
||||
" namespace M {"
|
||||
" class D {};"
|
||||
" }"
|
||||
"}"
|
||||
"N::M::D d;", elaboratedType()));
|
||||
"N::M::D d;",
|
||||
elaboratedType()));
|
||||
EXPECT_TRUE(matches("class C {} c;", elaboratedType()));
|
||||
EXPECT_TRUE(notMatches("class C {}; C c;", elaboratedType()));
|
||||
}
|
||||
|
@ -1894,20 +1850,19 @@ TEST_P(ASTMatchersTest, NestedNameSpecifier) {
|
|||
if (!GetParam().isCXX()) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(matches("namespace ns { struct A {}; } ns::A a;",
|
||||
nestedNameSpecifier()));
|
||||
EXPECT_TRUE(
|
||||
matches("namespace ns { struct A {}; } ns::A a;", nestedNameSpecifier()));
|
||||
EXPECT_TRUE(matches("template <typename T> class A { typename T::B b; };",
|
||||
nestedNameSpecifier()));
|
||||
EXPECT_TRUE(matches("struct A { void f(); }; void A::f() {}",
|
||||
nestedNameSpecifier()));
|
||||
EXPECT_TRUE(
|
||||
matches("struct A { void f(); }; void A::f() {}", nestedNameSpecifier()));
|
||||
EXPECT_TRUE(matches("namespace a { namespace b {} } namespace ab = a::b;",
|
||||
nestedNameSpecifier()));
|
||||
|
||||
EXPECT_TRUE(matches(
|
||||
"struct A { static void f() {} }; void g() { A::f(); }",
|
||||
EXPECT_TRUE(matches("struct A { static void f() {} }; void g() { A::f(); }",
|
||||
nestedNameSpecifier()));
|
||||
EXPECT_TRUE(notMatches(
|
||||
"struct A { static void f() {} }; void g(A* a) { a->f(); }",
|
||||
EXPECT_TRUE(
|
||||
notMatches("struct A { static void f() {} }; void g(A* a) { a->f(); }",
|
||||
nestedNameSpecifier()));
|
||||
}
|
||||
|
||||
|
@ -1931,8 +1886,8 @@ TEST_P(ASTMatchersTest, NestedNameSpecifier_MatchesTypes) {
|
|||
NestedNameSpecifierMatcher Matcher = nestedNameSpecifier(
|
||||
specifiesType(hasDeclaration(recordDecl(hasName("A")))));
|
||||
EXPECT_TRUE(matches("struct A { struct B {}; }; A::B b;", Matcher));
|
||||
EXPECT_TRUE(matches("struct A { struct B { struct C {}; }; }; A::B::C c;",
|
||||
Matcher));
|
||||
EXPECT_TRUE(
|
||||
matches("struct A { struct B { struct C {}; }; }; A::B::C c;", Matcher));
|
||||
EXPECT_TRUE(notMatches("namespace A { struct B {}; } A::B b;", Matcher));
|
||||
}
|
||||
|
||||
|
@ -1940,8 +1895,8 @@ TEST_P(ASTMatchersTest, NestedNameSpecifier_MatchesNamespaceDecls) {
|
|||
if (!GetParam().isCXX()) {
|
||||
return;
|
||||
}
|
||||
NestedNameSpecifierMatcher Matcher = nestedNameSpecifier(
|
||||
specifiesNamespace(hasName("ns")));
|
||||
NestedNameSpecifierMatcher Matcher =
|
||||
nestedNameSpecifier(specifiesNamespace(hasName("ns")));
|
||||
EXPECT_TRUE(matches("namespace ns { struct A {}; } ns::A a;", Matcher));
|
||||
EXPECT_TRUE(notMatches("namespace xx { struct A {}; } xx::A a;", Matcher));
|
||||
EXPECT_TRUE(notMatches("struct ns { struct A {}; }; ns::A a;", Matcher));
|
||||
|
@ -1955,10 +1910,9 @@ TEST_P(ASTMatchersTest,
|
|||
EXPECT_TRUE(matches(
|
||||
"struct A { struct B { struct C {}; }; }; A::B::C c;",
|
||||
nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A"))))));
|
||||
EXPECT_TRUE(matches(
|
||||
"struct A { struct B { struct C {}; }; }; A::B::C c;",
|
||||
nestedNameSpecifierLoc(hasPrefix(
|
||||
specifiesTypeLoc(loc(qualType(asString("struct A"))))))));
|
||||
EXPECT_TRUE(matches("struct A { struct B { struct C {}; }; }; A::B::C c;",
|
||||
nestedNameSpecifierLoc(hasPrefix(specifiesTypeLoc(
|
||||
loc(qualType(asString("struct A"))))))));
|
||||
EXPECT_TRUE(matches(
|
||||
"namespace N { struct A { struct B { struct C {}; }; }; } N::A::B::C c;",
|
||||
nestedNameSpecifierLoc(hasPrefix(
|
||||
|
@ -2100,43 +2054,31 @@ TEST(ASTMatchersTestObjC, ObjCMessageExpr) {
|
|||
" Str *up = [text uppercaseString];"
|
||||
"} "
|
||||
"@end ";
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
Objc1String,
|
||||
objcMessageExpr(anything())));
|
||||
EXPECT_TRUE(matchesObjC(Objc1String, objcMessageExpr(anything())));
|
||||
EXPECT_TRUE(matchesObjC(Objc1String,
|
||||
objcMessageExpr(hasAnySelector({
|
||||
"contents", "meth:"}))
|
||||
objcMessageExpr(hasAnySelector({"contents", "meth:"}))
|
||||
|
||||
));
|
||||
EXPECT_TRUE(
|
||||
matchesObjC(Objc1String, objcMessageExpr(hasSelector("contents"))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
Objc1String,
|
||||
objcMessageExpr(hasSelector("contents"))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
Objc1String,
|
||||
objcMessageExpr(hasAnySelector("contents", "contentsA"))));
|
||||
Objc1String, objcMessageExpr(hasAnySelector("contents", "contentsA"))));
|
||||
EXPECT_FALSE(matchesObjC(
|
||||
Objc1String,
|
||||
objcMessageExpr(hasAnySelector("contentsB", "contentsC"))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
Objc1String,
|
||||
objcMessageExpr(matchesSelector("cont*"))));
|
||||
EXPECT_FALSE(matchesObjC(
|
||||
Objc1String,
|
||||
objcMessageExpr(matchesSelector("?cont*"))));
|
||||
EXPECT_TRUE(notMatchesObjC(
|
||||
Objc1String,
|
||||
objcMessageExpr(hasSelector("contents"), hasNullSelector())));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
Objc1String,
|
||||
objcMessageExpr(hasSelector("contents"), hasUnarySelector())));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
Objc1String,
|
||||
objcMessageExpr(hasSelector("contents"), numSelectorArgs(0))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
Objc1String,
|
||||
objcMessageExpr(matchesSelector("uppercase*"),
|
||||
argumentCountIs(0)
|
||||
)));
|
||||
Objc1String, objcMessageExpr(hasAnySelector("contentsB", "contentsC"))));
|
||||
EXPECT_TRUE(
|
||||
matchesObjC(Objc1String, objcMessageExpr(matchesSelector("cont*"))));
|
||||
EXPECT_FALSE(
|
||||
matchesObjC(Objc1String, objcMessageExpr(matchesSelector("?cont*"))));
|
||||
EXPECT_TRUE(
|
||||
notMatchesObjC(Objc1String, objcMessageExpr(hasSelector("contents"),
|
||||
hasNullSelector())));
|
||||
EXPECT_TRUE(matchesObjC(Objc1String, objcMessageExpr(hasSelector("contents"),
|
||||
hasUnarySelector())));
|
||||
EXPECT_TRUE(matchesObjC(Objc1String, objcMessageExpr(hasSelector("contents"),
|
||||
numSelectorArgs(0))));
|
||||
EXPECT_TRUE(
|
||||
matchesObjC(Objc1String, objcMessageExpr(matchesSelector("uppercase*"),
|
||||
argumentCountIs(0))));
|
||||
}
|
||||
|
||||
TEST(ASTMatchersTestObjC, ObjCDecls) {
|
||||
|
@ -2157,33 +2099,17 @@ TEST(ASTMatchersTestObjC, ObjCDecls) {
|
|||
"- (void)abc_doThing {} "
|
||||
"@end ";
|
||||
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcProtocolDecl(hasName("Proto"))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcImplementationDecl(hasName("Thing"))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcCategoryDecl(hasName("ABC"))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcCategoryImplDecl(hasName("ABC"))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcMethodDecl(hasName("protoDidThing"))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcMethodDecl(hasName("abc_doThing"))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcMethodDecl(hasName("anything"))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcIvarDecl(hasName("_ivar"))));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcPropertyDecl(hasName("enabled"))));
|
||||
EXPECT_TRUE(matchesObjC(ObjCString, objcProtocolDecl(hasName("Proto"))));
|
||||
EXPECT_TRUE(
|
||||
matchesObjC(ObjCString, objcImplementationDecl(hasName("Thing"))));
|
||||
EXPECT_TRUE(matchesObjC(ObjCString, objcCategoryDecl(hasName("ABC"))));
|
||||
EXPECT_TRUE(matchesObjC(ObjCString, objcCategoryImplDecl(hasName("ABC"))));
|
||||
EXPECT_TRUE(
|
||||
matchesObjC(ObjCString, objcMethodDecl(hasName("protoDidThing"))));
|
||||
EXPECT_TRUE(matchesObjC(ObjCString, objcMethodDecl(hasName("abc_doThing"))));
|
||||
EXPECT_TRUE(matchesObjC(ObjCString, objcMethodDecl(hasName("anything"))));
|
||||
EXPECT_TRUE(matchesObjC(ObjCString, objcIvarDecl(hasName("_ivar"))));
|
||||
EXPECT_TRUE(matchesObjC(ObjCString, objcPropertyDecl(hasName("enabled"))));
|
||||
}
|
||||
|
||||
TEST(ASTMatchersTestObjC, ObjCExceptionStmts) {
|
||||
|
@ -2194,18 +2120,10 @@ TEST(ASTMatchersTestObjC, ObjCExceptionStmts) {
|
|||
" } @finally {}"
|
||||
"}";
|
||||
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcTryStmt()));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcThrowStmt()));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcCatchStmt()));
|
||||
EXPECT_TRUE(matchesObjC(
|
||||
ObjCString,
|
||||
objcFinallyStmt()));
|
||||
EXPECT_TRUE(matchesObjC(ObjCString, objcTryStmt()));
|
||||
EXPECT_TRUE(matchesObjC(ObjCString, objcThrowStmt()));
|
||||
EXPECT_TRUE(matchesObjC(ObjCString, objcCatchStmt()));
|
||||
EXPECT_TRUE(matchesObjC(ObjCString, objcFinallyStmt()));
|
||||
}
|
||||
|
||||
TEST(ASTMatchersTestObjC, ObjCAutoreleasePoolStmt) {
|
||||
|
@ -2274,11 +2192,18 @@ void x() {
|
|||
EXPECT_TRUE(matchesWithOpenMP(Source3, Matcher));
|
||||
|
||||
StringRef Source4 = R"(
|
||||
void x() {
|
||||
#pragma omp parallel default(firstprivate)
|
||||
;
|
||||
})";
|
||||
EXPECT_TRUE(matchesWithOpenMP51(Source4, Matcher));
|
||||
|
||||
StringRef Source5 = R"(
|
||||
void x(int x) {
|
||||
#pragma omp parallel num_threads(x)
|
||||
;
|
||||
})";
|
||||
EXPECT_TRUE(notMatchesWithOpenMP(Source4, Matcher));
|
||||
EXPECT_TRUE(notMatchesWithOpenMP(Source5, Matcher));
|
||||
}
|
||||
|
||||
TEST(ASTMatchersTest, Finder_DynamicOnlyAcceptsSomeMatchers) {
|
||||
|
|
|
@ -20,10 +20,10 @@ namespace clang {
|
|||
namespace ast_matchers {
|
||||
|
||||
using clang::tooling::buildASTFromCodeWithArgs;
|
||||
using clang::tooling::FileContentMappings;
|
||||
using clang::tooling::FrontendActionFactory;
|
||||
using clang::tooling::newFrontendActionFactory;
|
||||
using clang::tooling::runToolOnCodeWithArgs;
|
||||
using clang::tooling::FrontendActionFactory;
|
||||
using clang::tooling::FileContentMappings;
|
||||
|
||||
class BoundNodesCallback {
|
||||
public:
|
||||
|
@ -38,7 +38,8 @@ public:
|
|||
// If 'FindResultVerifier' is NULL, sets *Verified to true when Run is called.
|
||||
class VerifyMatch : public MatchFinder::MatchCallback {
|
||||
public:
|
||||
VerifyMatch(std::unique_ptr<BoundNodesCallback> FindResultVerifier, bool *Verified)
|
||||
VerifyMatch(std::unique_ptr<BoundNodesCallback> FindResultVerifier,
|
||||
bool *Verified)
|
||||
: Verified(Verified), FindResultReviewer(std::move(FindResultVerifier)) {}
|
||||
|
||||
void run(const MatchFinder::MatchResult &Result) override {
|
||||
|
@ -124,10 +125,9 @@ testing::AssertionResult matchesConditionally(
|
|||
return testing::AssertionFailure() << "Parsing error in \"" << Code << "\"";
|
||||
}
|
||||
if (Found != DynamicFound) {
|
||||
return testing::AssertionFailure() << "Dynamic match result ("
|
||||
<< DynamicFound
|
||||
<< ") does not match static result ("
|
||||
<< Found << ")";
|
||||
return testing::AssertionFailure()
|
||||
<< "Dynamic match result (" << DynamicFound
|
||||
<< ") does not match static result (" << Found << ")";
|
||||
}
|
||||
if (!Found && ExpectMatch) {
|
||||
return testing::AssertionFailure()
|
||||
|
@ -216,7 +216,8 @@ matchesConditionallyWithCuda(const Twine &Code, const T &AMatcher,
|
|||
" size_t sharedSize = 0,"
|
||||
" cudaStream_t stream = 0);"
|
||||
"extern \"C\" unsigned __cudaPushCallConfiguration("
|
||||
" dim3 gridDim, dim3 blockDim, size_t sharedMem = 0, void *stream = 0);";
|
||||
" dim3 gridDim, dim3 blockDim, size_t sharedMem = 0, void *stream = "
|
||||
"0);";
|
||||
|
||||
bool Found = false, DynamicFound = false;
|
||||
MatchFinder Finder;
|
||||
|
@ -233,15 +234,13 @@ matchesConditionallyWithCuda(const Twine &Code, const T &AMatcher,
|
|||
std::vector<std::string> Args = {
|
||||
"-xcuda", "-fno-ms-extensions", "--cuda-host-only", "-nocudainc",
|
||||
"-target", "x86_64-unknown-unknown", std::string(CompileArg)};
|
||||
if (!runToolOnCodeWithArgs(Factory->create(),
|
||||
CudaHeader + Code, Args)) {
|
||||
if (!runToolOnCodeWithArgs(Factory->create(), CudaHeader + Code, Args)) {
|
||||
return testing::AssertionFailure() << "Parsing error in \"" << Code << "\"";
|
||||
}
|
||||
if (Found != DynamicFound) {
|
||||
return testing::AssertionFailure() << "Dynamic match result ("
|
||||
<< DynamicFound
|
||||
<< ") does not match static result ("
|
||||
<< Found << ")";
|
||||
return testing::AssertionFailure()
|
||||
<< "Dynamic match result (" << DynamicFound
|
||||
<< ") does not match static result (" << Found << ")";
|
||||
}
|
||||
if (!Found && ExpectMatch) {
|
||||
return testing::AssertionFailure()
|
||||
|
@ -276,13 +275,28 @@ testing::AssertionResult notMatchesWithOpenMP(const Twine &Code,
|
|||
return matchesConditionally(Code, AMatcher, false, {"-fopenmp=libomp"});
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
testing::AssertionResult matchesWithOpenMP51(const Twine &Code,
|
||||
const T &AMatcher) {
|
||||
return matchesConditionally(Code, AMatcher, true,
|
||||
{"-fopenmp=libomp", "-fopenmp-version=51"});
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
testing::AssertionResult notMatchesWithOpenMP51(const Twine &Code,
|
||||
const T &AMatcher) {
|
||||
return matchesConditionally(Code, AMatcher, false,
|
||||
{"-fopenmp=libomp", "-fopenmp-version=51"});
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
testing::AssertionResult matchAndVerifyResultConditionally(
|
||||
const Twine &Code, const T &AMatcher,
|
||||
std::unique_ptr<BoundNodesCallback> FindResultVerifier, bool ExpectResult) {
|
||||
bool VerifiedResult = false;
|
||||
MatchFinder Finder;
|
||||
VerifyMatch VerifyVerifiedResult(std::move(FindResultVerifier), &VerifiedResult);
|
||||
VerifyMatch VerifyVerifiedResult(std::move(FindResultVerifier),
|
||||
&VerifiedResult);
|
||||
Finder.addMatcher(AMatcher, &VerifyVerifiedResult);
|
||||
std::unique_ptr<FrontendActionFactory> Factory(
|
||||
newFrontendActionFactory(&Finder));
|
||||
|
@ -307,8 +321,8 @@ testing::AssertionResult matchAndVerifyResultConditionally(
|
|||
std::unique_ptr<ASTUnit> AST(
|
||||
buildASTFromCodeWithArgs(Code.toStringRef(Buffer), Args));
|
||||
if (!AST.get())
|
||||
return testing::AssertionFailure() << "Parsing error in \"" << Code
|
||||
<< "\" while building AST";
|
||||
return testing::AssertionFailure()
|
||||
<< "Parsing error in \"" << Code << "\" while building AST";
|
||||
Finder.matchAST(AST->getASTContext());
|
||||
if (!VerifiedResult && ExpectResult) {
|
||||
return testing::AssertionFailure()
|
||||
|
@ -327,8 +341,8 @@ template <typename T>
|
|||
testing::AssertionResult matchAndVerifyResultTrue(
|
||||
const Twine &Code, const T &AMatcher,
|
||||
std::unique_ptr<BoundNodesCallback> FindResultVerifier) {
|
||||
return matchAndVerifyResultConditionally(
|
||||
Code, AMatcher, std::move(FindResultVerifier), true);
|
||||
return matchAndVerifyResultConditionally(Code, AMatcher,
|
||||
std::move(FindResultVerifier), true);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -342,8 +356,7 @@ testing::AssertionResult matchAndVerifyResultFalse(
|
|||
// Implements a run method that returns whether BoundNodes contains a
|
||||
// Decl bound to Id that can be dynamically cast to T.
|
||||
// Optionally checks that the check succeeded a specific number of times.
|
||||
template <typename T>
|
||||
class VerifyIdIsBoundTo : public BoundNodesCallback {
|
||||
template <typename T> class VerifyIdIsBoundTo : public BoundNodesCallback {
|
||||
public:
|
||||
// Create an object that checks that a node of type \c T was bound to \c Id.
|
||||
// Does not check for a certain number of matches.
|
||||
|
|
|
@ -982,6 +982,7 @@ __OMP_CANCEL_KIND(taskgroup, 4)
|
|||
|
||||
__OMP_DEFAULT_KIND(none)
|
||||
__OMP_DEFAULT_KIND(shared)
|
||||
__OMP_DEFAULT_KIND(firstprivate)
|
||||
__OMP_DEFAULT_KIND(unknown)
|
||||
|
||||
#undef __OMP_DEFAULT_KIND
|
||||
|
|
Loading…
Reference in New Issue