[clang] [clang][sema] forbid vector_size attr when specify `-mgeneral-regs-only` on x86 (PR #75350)

via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 14 00:47:39 PST 2023


================
@@ -8251,6 +8251,25 @@ static void HandleVectorSizeAttr(QualType &CurType, const ParsedAttr &Attr,
     return;
   }
 
+  // check -mgeneral-regs-only is specified
+  const TargetInfo &targetInfo = S.getASTContext().getTargetInfo();
+  llvm::Triple::ArchType arch = targetInfo.getTriple().getArch();
+  const auto HasFeature = [](const clang::TargetOptions &targetOpts,
+                             const std::string &feature) {
+    return std::find(targetOpts.Features.begin(), targetOpts.Features.end(),
+                     feature) != targetOpts.Features.end();
+  };
+  if (CurType->isSpecificBuiltinType(BuiltinType::LongDouble)) {
----------------
knightXun wrote:

that's great advice!

https://github.com/llvm/llvm-project/pull/75350


More information about the cfe-commits mailing list