[clang] [clang][ASTImporter] Link FunctionDecl into its DeclContext before importing its body (PR #214009)

via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 5 06:47:12 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/Analysis/ctu/regression/self-referential-lambda-import.cpp clang/lib/AST/ASTImporter.cpp clang/unittests/AST/ASTImporterTest.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/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index d7a8d7f6f..2702da1a0 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -9286,13 +9286,13 @@ TEST_P(ASTImporterOptionSpecificTestBase,
   // the entire namespace, including the concrete specialization that
   // refers back to the lambda's closure type. When that closure is
   // force-imported, the process reaches the lambda's call operator body,
-  // which references the same self-referencing global variable again. 
-  // Because the variable isn't mapped yet, the importer revisits it and 
-  // rebuilds a second, independent LambdaExpr for the same closure while 
+  // which references the same self-referencing global variable again.
+  // Because the variable isn't mapped yet, the importer revisits it and
+  // rebuilds a second, independent LambdaExpr for the same closure while
   // its call operator is still being imported into it.
-  // 
-  // Finally, the sequence LambdaExpr::Create() -> 
-  // CXXRecordDecl::getLambdaCallOperator() performs a name lookup on the 
+  //
+  // Finally, the sequence LambdaExpr::Create() ->
+  // CXXRecordDecl::getLambdaCallOperator() performs a name lookup on the
   // lambda closure that is currently being constructed.
   const char *Code =
       R"(

``````````

</details>


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


More information about the cfe-commits mailing list