[PATCH] D142384: [C++20] Fix a crash with modules.

Utkarsh Saxena via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 1 06:05:04 PST 2023


usaxena95 updated this revision to Diff 493926.
usaxena95 added a comment.

Moved to RecordDecl::field_begin. Assertion is no more valid in RecordDecl.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142384/new/

https://reviews.llvm.org/D142384

Files:
  clang/lib/AST/Decl.cpp


Index: clang/lib/AST/Decl.cpp
===================================================================
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -4769,7 +4769,8 @@
 RecordDecl::field_iterator RecordDecl::field_begin() const {
   if (hasExternalLexicalStorage() && !hasLoadedFieldsFromExternalStorage())
     LoadFieldsFromExternalStorage();
-
+  if (RecordDecl *D = getDefinition(); D && D != this)
+    return D->field_begin();
   return field_iterator(decl_iterator(FirstDecl));
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142384.493926.patch
Type: text/x-patch
Size: 496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230201/4f3000ef/attachment.bin>


More information about the cfe-commits mailing list