This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGb6121432da79: [C++20] Fix a crash with modules. (authored by usaxena95).
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 @@ -4770,7 +4770,10 @@ RecordDecl::field_iterator RecordDecl::field_begin() const { if (hasExternalLexicalStorage() && !hasLoadedFieldsFromExternalStorage()) LoadFieldsFromExternalStorage(); - + // This is necessary for correctness for C++ with modules. + // FIXME: Come up with a test case that breaks without definition. + if (RecordDecl *D = getDefinition(); D && D != this) + return D->field_begin(); return field_iterator(decl_iterator(FirstDecl)); }
Index: clang/lib/AST/Decl.cpp =================================================================== --- clang/lib/AST/Decl.cpp +++ clang/lib/AST/Decl.cpp @@ -4770,7 +4770,10 @@ RecordDecl::field_iterator RecordDecl::field_begin() const { if (hasExternalLexicalStorage() && !hasLoadedFieldsFromExternalStorage()) LoadFieldsFromExternalStorage(); - + // This is necessary for correctness for C++ with modules. + // FIXME: Come up with a test case that breaks without definition. + if (RecordDecl *D = getDefinition(); D && D != this) + return D->field_begin(); return field_iterator(decl_iterator(FirstDecl)); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits