[clang] [C++20][Modules] Load function body from the module that gives canonical decl (PR #111992)

via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 11 08:23:09 PST 2024


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 0772a0bd29afa33520abf1c5a8bae09a718954b2 936f4a705b91f958bfa531758222a14109f6a902 --extensions cpp,h -- clang/test/Headers/crash-instantiated-in-scope-cxx-modules4.cpp clang/test/Modules/friend-inline-function-body.cpp clang/include/clang/Serialization/ASTBitCodes.h clang/include/clang/Serialization/ASTReader.h clang/include/clang/Serialization/ASTWriter.h clang/lib/Sema/SemaTemplateInstantiateDecl.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/lib/Serialization/ASTWriter.cpp clang/lib/Serialization/ASTWriterDecl.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index ede0257171..fa14e606a0 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -2155,9 +2155,9 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(
   // definition during AST merges from different modules, in this case decl
   // with function body should be used for instantiation.
   if (isFriend) {
-    const FunctionDecl* Defn = nullptr;
+    const FunctionDecl *Defn = nullptr;
     if (D->hasBody(Defn)) {
-      D = const_cast<FunctionDecl*>(Defn);
+      D = const_cast<FunctionDecl *>(Defn);
       FunctionTemplate = Defn->getDescribedFunctionTemplate();
     }
   }

``````````

</details>


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


More information about the cfe-commits mailing list