usaxena95 updated this revision to Diff 494314. usaxena95 marked an inline comment as done. usaxena95 added a comment.
Addressed comments. 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,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 @@ -4769,7 +4769,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