[clang] [Clang] Correctly initialize placeholder fields from their initializers (PR #114196)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 08:58:08 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 9a5e5a6ecc96fb8fb3642c73ff585cb6b919f653 c3b882f0e85266a48e82a8dc38d5e1440e633671 --extensions cpp,h -- clang/include/clang/AST/ASTContext.h clang/lib/AST/ASTContext.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaTemplateInstantiateDecl.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/lib/Serialization/ASTWriterDecl.cpp clang/test/SemaCXX/cxx2c-placeholder-vars.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e0b564175a..49fdb5b5ab 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -5568,11 +5568,10 @@ static FieldDecl *FindFieldDeclInstantiationPattern(const ASTContext &Ctx,
   CXXRecordDecl *ClassPattern = ParentRD->getTemplateInstantiationPattern();
   DeclContext::lookup_result Lookup =
       ClassPattern->lookup(Field->getDeclName());
-  auto Rng = llvm::make_filter_range(Lookup, [] (auto && L) {
-      return isa<FieldDecl>(*L);
-  });
-  if(Rng.empty())
-      return nullptr;
+  auto Rng = llvm::make_filter_range(
+      Lookup, [](auto &&L) { return isa<FieldDecl>(*L); });
+  if (Rng.empty())
+    return nullptr;
   // FIXME: this breaks clang/test/Modules/pr28812.cpp
   // assert(std::distance(Rng.begin(), Rng.end()) <= 1
   //       && "Duplicated instantiation pattern for field decl");

``````````

</details>


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


More information about the cfe-commits mailing list