[clang] [clang][LoongArch] Check target features in CheckLoongArchBuiltinFunctionCall (PR #191811)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 16 05:17:46 PDT 2026
================
@@ -22,6 +25,20 @@ SemaLoongArch::SemaLoongArch(Sema &S) : SemaBase(S) {}
bool SemaLoongArch::CheckLoongArchBuiltinFunctionCall(const TargetInfo &TI,
unsigned BuiltinID,
CallExpr *TheCall) {
+ ASTContext &Context = getASTContext();
+ const FunctionDecl *FD = SemaRef.getCurFunctionDecl();
+
+ llvm::StringRef Features = Context.BuiltinInfo.getRequiredFeatures(BuiltinID);
+ // Only check it when the builtin is not used in a function.
+ if (!Features.empty() && !FD) {
+ llvm::SmallVector<StringRef> RequiredFeatures;
+ Features.split(RequiredFeatures, ',');
+ for (auto RF : RequiredFeatures)
+ if (!TI.hasFeature(RF))
----------------
lrzlin wrote:
Done.
https://github.com/llvm/llvm-project/pull/191811
More information about the cfe-commits
mailing list