From 5a4cb1eb0c4e2560397c009da45d57bb1ebb6135 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 18 Aug 2018 08:26:59 +0000 Subject: Vendor import of clang release_70 branch r339999: https://llvm.org/svn/llvm-project/cfe/branches/release_70@339999 --- lib/AST/ASTContext.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/AST/ASTContext.cpp') diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index d50f4493788a..c085f52cae31 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -9798,20 +9798,16 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { return true; // If the decl is marked as `declare target`, it should be emitted. - for (const auto *Decl : D->redecls()) { - if (!Decl->hasAttrs()) - continue; - if (const auto *Attr = Decl->getAttr()) - if (Attr->getMapType() != OMPDeclareTargetDeclAttr::MT_Link) - return true; - } + if (const llvm::Optional Res = + OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD)) + return *Res != OMPDeclareTargetDeclAttr::MT_Link; return false; } void ASTContext::forEachMultiversionedFunctionVersion( const FunctionDecl *FD, - llvm::function_ref Pred) const { + llvm::function_ref Pred) const { assert(FD->isMultiVersion() && "Only valid for multiversioned functions"); llvm::SmallDenseSet SeenDecls; FD = FD->getCanonicalDecl(); -- cgit v1.3