[clang] [clang][CodeGen] Trigger AST lookup for libfunction builtins (PR #209997)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 00:55:40 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- clang/test/Modules/builtin-libfunction-lookup.cpp clang/lib/CodeGen/CGBuiltin.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index c0022ae14..cb5ff27a8 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -251,10 +251,11 @@ llvm::Constant *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
   // normal function calls where Sema performs name lookup and lazily
   // deserializes declarations from Clang Modules (PCMs), built-in library
   // function calls (e.g. __builtin_hypotf) bypass Sema name lookup for the C
-  // function name ("hypotf"). Explicitly looking up the name in TranslationUnitDecl
-  // triggers ASTReader to lazily deserialize any module-defined declaration (such
-  // as MSVC UCRT's inline hypotf wrapper). If found, use GetAddrOfFunction to
-  // properly emit its definition and dependencies.
+  // function name ("hypotf"). Explicitly looking up the name in
+  // TranslationUnitDecl triggers ASTReader to lazily deserialize any
+  // module-defined declaration (such as MSVC UCRT's inline hypotf wrapper). If
+  // found, use GetAddrOfFunction to properly emit its definition and
+  // dependencies.
   DeclarationName DecName = &Context.Idents.get(Name);
   DeclContext::lookup_result Decls =
       Context.getTranslationUnitDecl()->lookup(DecName);

``````````

</details>


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


More information about the cfe-commits mailing list