diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-10-08 19:44:16 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-10-08 19:44:16 +0000 |
commit | 1d45d5ea2ab93d16f72d3f68c4092e31a1796f75 (patch) | |
tree | c386b008fb7d01a6c73cd83820211de2d32e45c3 /lib/Parse/ParseOpenMP.cpp | |
parent | b9ffe7a90f9e93654e4a20ddb36f75353808b7a0 (diff) | |
download | clang-1d45d5ea2ab93d16f72d3f68c4092e31a1796f75.tar.gz |
[OPENMP50]Multiple vendors in vendor context must be treated as logical
and of vendors, not or.
If several vendors are provided in the same vendor context trait, the
context shall match only if all vendors are matching, not one of them.
This is per OpenMP 5.0, 2.3.3 Matching and Scoring Context Selectors,
all selectors in the construct, device, and implementation sets of the
context selector appear in the corresponding trait set of the OpenMP
context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseOpenMP.cpp')
-rw-r--r-- | lib/Parse/ParseOpenMP.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Parse/ParseOpenMP.cpp b/lib/Parse/ParseOpenMP.cpp index f667b83b58..82a4e70055 100644 --- a/lib/Parse/ParseOpenMP.cpp +++ b/lib/Parse/ParseOpenMP.cpp @@ -853,6 +853,7 @@ static void parseImplementationSelector( (void)T.expectAndConsume(diag::err_expected_lparen_after, CtxSelectorName.data()); const ExprResult Score = parseContextScore(P); + SmallVector<llvm::SmallString<16>, 4> Vendors; do { // Parse <vendor>. StringRef VendorName; @@ -860,18 +861,14 @@ static void parseImplementationSelector( Buffer.clear(); VendorName = P.getPreprocessor().getSpelling(P.getCurToken(), Buffer); (void)P.ConsumeToken(); + if (!VendorName.empty()) + Vendors.push_back(VendorName); } else { P.Diag(Tok.getLocation(), diag::err_omp_declare_variant_item_expected) << "vendor identifier" << "vendor" << "implementation"; } - if (!VendorName.empty()) { - Sema::OpenMPDeclareVariantCtsSelectorData Data( - OMPDeclareVariantAttr::CtxSetImplementation, CSKind, VendorName, - Score); - Callback(SourceRange(Loc, Tok.getLocation()), Data); - } if (!P.TryConsumeToken(tok::comma) && Tok.isNot(tok::r_paren)) { P.Diag(Tok, diag::err_expected_punc) << (VendorName.empty() ? "vendor name" : VendorName); @@ -879,6 +876,15 @@ static void parseImplementationSelector( } while (Tok.is(tok::identifier)); // Parse ')'. (void)T.consumeClose(); + if (!Vendors.empty()) { + SmallVector<StringRef, 4> ImplVendors(Vendors.size()); + for (int I = 0, E = Vendors.size(); I < E; ++I) + ImplVendors[I] = Vendors[I]; + Sema::OpenMPDeclareVariantCtsSelectorData Data( + OMPDeclareVariantAttr::CtxSetImplementation, CSKind, ImplVendors, + Score); + Callback(SourceRange(Loc, Tok.getLocation()), Data); + } break; } case OMPDeclareVariantAttr::CtxUnknown: |