[clang] [Clang][CodeGen] Automatically resolve MSVC _hypotf and dllimport for… (PR #207135)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 15 02:22:57 PDT 2026


================
@@ -247,10 +247,35 @@ llvm::Constant *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
       Name = Context.BuiltinInfo.getName(BuiltinID).substr(10);
   }
 
+  // If no standard library declaration was found in the AST (freestanding
+  // code calling builtins directly without headers), perform automatic
+  // resolution of MSVC CRT symbol names and DLL import attributes.
+  bool IsNoHeader = (D == GlobalDecl(FD));
+  if (IsNoHeader && getTriple().isWindowsMSVCEnvironment() &&
+      Name == "hypotf") {
+    // Map C99 float math functions to their MSVC CRT prefixed names on Windows.
+    // (Only hypotf needs mapping as it is not exported without prefix in UCRT
+    // on both x86 and x64).
+    Name = "_hypotf";
----------------
arsenm wrote:

I want to turn RuntimeLibcallsInfo into a centralized repository of all call ABI knowledge, and merge into TargetLibraryInfo. It should be aware of the platform type signature, attributes, calling convention, visibility etc. 

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


More information about the cfe-commits mailing list