ABataev 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()); ---------------- 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; ``` ================ Comment at: clang/lib/Sema/SemaOpenMP.cpp:2703 + OMPDeclareTargetDeclAttr::getDeviceType( + VariantFD->getMostRecentDecl()); + if (!DevTy || *DevTy == OMPDeclareTargetDeclAttr::DT_Host) ---------------- Why the most recent decl? ================ Comment at: clang/lib/Sema/SemaOpenMP.cpp:2704 + VariantFD->getMostRecentDecl()); + if (!DevTy || *DevTy == OMPDeclareTargetDeclAttr::DT_Host) + HasHostFunctionVariant = true; ---------------- Isuppose it must be `DevTy && *DevTy == OMPDeclareTargetDeclAttr::DT_Host`, no? 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