[clang] [clang][Sema] Don't warn for implicit uses of builtins in system headers (PR #138205)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Fri May 2 14:47:24 PDT 2025


================
@@ -2376,9 +2376,14 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID,
     return nullptr;
   }
 
+  // Warn for implicit uses of header dependent libraries,
+  // except in system headers.
   if (!ForRedeclaration &&
       (Context.BuiltinInfo.isPredefinedLibFunction(ID) ||
-       Context.BuiltinInfo.isHeaderDependentFunction(ID))) {
+       Context.BuiltinInfo.isHeaderDependentFunction(ID)) &&
+      (!getDiagnostics().getSuppressSystemWarnings() ||
+       !Context.getSourceManager().isInSystemHeader(
+           Context.getSourceManager().getSpellingLoc(Loc)))) {
----------------
Artem-B wrote:

I think we may want to narrow down the scope of which diagnostics we want to suppress and when. 
While we do know that we may need it for these builting for windows on ARM, I can not say whether we want to do that to other intrinsics for other targets.

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


More information about the cfe-commits mailing list