diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2019-09-26 20:04:15 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-09-26 20:04:15 +0000 |
| commit | 1202614d16e894f244e9f9afd391b1445c7a96c4 (patch) | |
| tree | f788c9a8afbc7511d29e466048436022aca1d165 /clang/lib | |
| parent | 3b808fb330dd4e2c8bf54e88e0a820e835c278b5 (diff) | |
| download | bcm5719-llvm-1202614d16e894f244e9f9afd391b1445c7a96c4.tar.gz bcm5719-llvm-1202614d16e894f244e9f9afd391b1445c7a96c4.zip | |
[OPENMP50]Emit warnings if the functions was defined/used before marked
declare variant.
We can use the original function if it was used/emitted already. So,
just use warnings for these cases, not errors.
llvm-svn: 373010
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 0403f11f6b7..17586c90bd1 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -4931,11 +4931,15 @@ Sema::checkOpenMPDeclareVariantFunction(Sema::DeclGroupPtrTy DG, } // Allow #pragma omp declare variant only if the function is not used. - if (FD->isUsed(false)) { - Diag(SR.getBegin(), diag::err_omp_declare_variant_after_used) + if (FD->isUsed(false)) + Diag(SR.getBegin(), diag::warn_omp_declare_variant_after_used) + << FD->getLocation(); + + // Check if the function was emitted already. + if ((LangOpts.EmitAllDecls && FD->isDefined()) || + Context.DeclMustBeEmitted(FD)) + Diag(SR.getBegin(), diag::warn_omp_declare_variant_after_emitted) << FD->getLocation(); - return None; - } // The VariantRef must point to function. if (!VariantRef) { |

