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

Nick Sarnie via cfe-commits cfe-commits at lists.llvm.org
Fri May 16 15:04:00 PDT 2025


================
@@ -1825,6 +1825,11 @@ class Sema final : public SemaBase {
   /// Set of no-builtin functions listed by \#pragma function.
   llvm::SmallSetVector<StringRef, 4> MSFunctionNoBuiltins;
 
+  /// Map of BuiltinIDs to source locations that have #pragma intrinsic calls
+  /// that refer to them.
+  llvm::DenseMap<unsigned, llvm::SmallSetVector<SourceLocation, 4>>
----------------
sarnex wrote:

Sorry, I intended to write a comment explaining this commit but I got distracted and you reviewed it too fast :)

I will say that I tried creating the declaration just by calling `LazilyCreateBuiltin` in the pragma handler, but that caused problems when there is a declaration in the header because then we get a ambigous call error. The reason that doesn't happen today with no changes is because we only call `LazilyCreateBuiltin` when the lookup fails, ex when there is no header providing a declaration. 

Let me try your idea, thanks for the feedback.

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


More information about the cfe-commits mailing list