From 0213adde218530bc31e5c4e50b49704c6bb2f2e9 Mon Sep 17 00:00:00 2001 From: Erich Keane Date: Mon, 18 Nov 2019 13:38:56 -0800 Subject: [PATCH] [NFC] Fix 'target' condition in checkTargetFeatures checkTargetFeatures was incorrectly checking for cpu_specific instead of just 'target'. While this function was never called in that situation, it seemed correct to fix the condition. Additionally, multiversion functions can never be always_inline, but if any function accidentially ended up here we shouldn't diagnose. Note that the adding of target-features to the list is unnecessary since the getFunctionFeatureMap actually considers attribute target, however adding it results in significantly better error messages by putting the 'target' features first (and thus first to fail). Otherwise, the error message would be the first feature 'implied' by the target attribute, and not necessarily the feature listed in the attribute itself. --- clang/lib/CodeGen/CodeGenFunction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 6f2bd8c16b3b..68b599e88bc3 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -2223,8 +2223,8 @@ void CodeGenFunction::checkTargetFeatures(SourceLocation Loc, << TargetDecl->getDeclName() << CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID); - } else if (TargetDecl->hasAttr() || - TargetDecl->hasAttr()) { + } else if (!TargetDecl->isMultiVersion() && + TargetDecl->hasAttr()) { // Get the required features for the callee. const TargetAttr *TD = TargetDecl->getAttr();