summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-10-02 18:19:02 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2019-10-02 18:19:02 +0000
commit583cd05ce39d3342e4da7887fd5fbd828507c043 (patch)
tree2525d77c1bc69daceaad3f1476c7bfedaf025611 /lib/Sema/SemaOpenMP.cpp
parentaef104aca0c640a9645dcc94ce0fb8ca54ff4d2d (diff)
downloadclang-583cd05ce39d3342e4da7887fd5fbd828507c043.tar.gz
[OPENMP50]Add parsing/sema analysis for declare variant score.
Context selectors may include optional score clause in format `score(<expr>):`, where `<expr>` must be a constant integer expression. Added parsing/sema analysis only. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373502 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOpenMP.cpp')
-rw-r--r--lib/Sema/SemaOpenMP.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp
index 42e1755b58..2b659f7f11 100644
--- a/lib/Sema/SemaOpenMP.cpp
+++ b/lib/Sema/SemaOpenMP.cpp
@@ -5112,8 +5112,23 @@ void Sema::ActOnOpenMPDeclareVariantDirective(
if (Data.CtxSet == OMPDeclareVariantAttr::CtxSetUnknown ||
Data.Ctx == OMPDeclareVariantAttr::CtxUnknown)
return;
+ Expr *Score = nullptr;
+ OMPDeclareVariantAttr::ScoreType ST = OMPDeclareVariantAttr::ScoreUnknown;
+ if (Data.CtxScore.isUsable()) {
+ ST = OMPDeclareVariantAttr::ScoreSpecified;
+ Score = Data.CtxScore.get();
+ if (!Score->isTypeDependent() && !Score->isValueDependent() &&
+ !Score->isInstantiationDependent() &&
+ !Score->containsUnexpandedParameterPack()) {
+ llvm::APSInt Result;
+ ExprResult ICE = VerifyIntegerConstantExpression(Score, &Result);
+ if (ICE.isInvalid())
+ return;
+ }
+ }
auto *NewAttr = OMPDeclareVariantAttr::CreateImplicit(
- Context, VariantRef, Data.CtxSet, Data.Ctx, Data.ImplVendor, SR);
+ Context, VariantRef, Score, Data.CtxSet, ST, Data.Ctx, Data.ImplVendor,
+ SR);
FD->addAttr(NewAttr);
}