[clang] 0213add - [NFC] Fix 'target' condition in checkTargetFeatures

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 13:44:06 PST 2019


Author: Erich Keane
Date: 2019-11-18T13:43:52-08:00
New Revision: 0213adde218530bc31e5c4e50b49704c6bb2f2e9

URL: https://github.com/llvm/llvm-project/commit/0213adde218530bc31e5c4e50b49704c6bb2f2e9
DIFF: https://github.com/llvm/llvm-project/commit/0213adde218530bc31e5c4e50b49704c6bb2f2e9.diff

LOG: [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.

Added: 
    

Modified: 
    clang/lib/CodeGen/CodeGenFunction.cpp

Removed: 
    


################################################################################
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<TargetAttr>() ||
-             TargetDecl->hasAttr<CPUSpecificAttr>()) {
+  } else if (!TargetDecl->isMultiVersion() &&
+             TargetDecl->hasAttr<TargetAttr>()) {
     // Get the required features for the callee.
 
     const TargetAttr *TD = TargetDecl->getAttr<TargetAttr>();


        


More information about the cfe-commits mailing list