[clang] [Clang][AMDGPU] Name the builtin in required target feature diagnostics (PR #218358)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 24 05:55:09 PDT 2026
================
@@ -34,6 +34,23 @@ namespace clang {
SemaAMDGPU::SemaAMDGPU(Sema &S) : SemaBase(S) {}
+bool SemaAMDGPU::checkBuiltinRequiredTargetFeatures(
+ unsigned BuiltinID, CallExpr *TheCall,
+ const llvm::StringMap<bool> &CallerFeatureMap) {
+ ASTContext &Ctx = getASTContext();
+ StringRef FeatureList(Ctx.BuiltinInfo.getRequiredFeatures(BuiltinID));
+ if (Builtin::evaluateRequiredTargetFeatures(FeatureList, CallerFeatureMap))
+ return false;
+
+ const FunctionDecl *BuiltinDecl = TheCall->getDirectCallee();
+ Diag(TheCall->getBeginLoc(), diag::err_builtin_needs_feature)
+ << (BuiltinDecl ? BuiltinDecl->getDeclName()
+ : DeclarationName(&Ctx.Idents.get(
----------------
Fznamznon wrote:
If we can always just get the function name from `ASTContext` using `BuiltinID` why don't we always do that instead of using `CallExpr`?
https://github.com/llvm/llvm-project/pull/218358
More information about the cfe-commits
mailing list