diff options
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: |

