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 | 303657a6c6f440f1855f6680c8bb1c8a7b815535 (patch) | |
| tree | 96160f0aad0f872949c70622344b899530166d86 /clang/lib/Parse/ParseOpenMP.cpp | |
| parent | 07c5f2a9b0add36974250cd9ab9152458e8b3361 (diff) | |
| download | bcm5719-llvm-303657a6c6f440f1855f6680c8bb1c8a7b815535.tar.gz bcm5719-llvm-303657a6c6f440f1855f6680c8bb1c8a7b815535.zip | |
[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.
llvm-svn: 374107
Diffstat (limited to 'clang/lib/Parse/ParseOpenMP.cpp')
| -rw-r--r-- | clang/lib/Parse/ParseOpenMP.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index f667b83b583..82a4e700552 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/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: |

