[Modules] Fix creating fake definition data for lambdas.During reading C++ definition data for lambda we can accessCXXRecordDecl representing lambda before we finished reading thedefinition data.
[Modules] Fix creating fake definition data for lambdas.During reading C++ definition data for lambda we can accessCXXRecordDecl representing lambda before we finished reading thedefinition data. This can happen by reading a captured variable which isVarDecl, then reading its decl context which is CXXMethodDecl `operator()`,then trying to merge redeclarable methods and accessingenclosing CXXRecordDecl. The call stack looks roughly like VisitCXXRecordDecl ReadCXXRecordDefinition VisitVarDecl VisitCXXMethodDecl mergeRedeclarable getPrimaryContextForMergingIf we add fake definition data at this point, later we'll hit the assertion Assertion failed: (!DD.IsLambda && !MergeDD.IsLambda && "faked up lambda definition?"), function MergeDefinitionData, file clang/lib/Serialization/ASTReaderDecl.cpp, line 1675.The fix is to assign definition data before reading it. Fixes PR32556.rdar://problem/37461072Reviewers: rsmith, brunoReviewed By: rsmithSubscribers: cfe-commits, jkorous-apple, aprantlDifferential Revision: https://reviews.llvm.org/D43494llvm-svn: 328153
show more ...