doru1004 added inline comments.
================ Comment at: clang/lib/Sema/SemaOpenMP.cpp:2697-2706 + for (OMPDeclareVariantAttr *A : + Callee->specific_attrs<OMPDeclareVariantAttr>()) { + auto *DeclRefVariant = cast<DeclRefExpr>(A->getVariantFuncRef()); + auto *VariantFD = cast<FunctionDecl>(DeclRefVariant->getDecl()); + Optional<OMPDeclareTargetDeclAttr::DevTypeTy> DevTy = + OMPDeclareTargetDeclAttr::getDeviceType( + VariantFD->getMostRecentDecl()); ---------------- ABataev wrote: > It is recommended to implement such loops as functions/lauto &ambdas: > ``` > auto HasHostAttr = []() { > for (const OMPDeclareVariantAttr *A : > Callee->specific_attrs<OMPDeclareVariantAttr>()) { > auto *DeclRefVariant = cast<DeclRefExpr>(A->getVariantFuncRef()); > auto *VariantFD = cast<FunctionDecl>(DeclRefVariant->getDecl()); > Optional<OMPDeclareTargetDeclAttr::DevTypeTy> DevTy = > OMPDeclareTargetDeclAttr::getDeviceType( > VariantFD->getMostRecentDecl()); > if (!DevTy || *DevTy == OMPDeclareTargetDeclAttr::DT_Host) > return true; > } > return false; > }; > if (HasHostAttr()) > return; > ``` I will rewrite this. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140155/new/ https://reviews.llvm.org/D140155 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits