teemperor created this revision. teemperor added a reviewer: shafik. Herald added subscribers: lldb-commits, JDevlieghere. Herald added a project: LLDB.
Calling `addDecl` on a CXXRecordDecl is not a trivial method but is actually inspecting the added declarations to infer properties about the CXXRecordDecl. Whatever declaration we pass to `addDecl` should be in its final state so we should first set all the properties of such a decl and then call `addDecl`. If we do it the other way around like we do here then `addDecl` may do incorrect decisions. The only code that is currently after `addDecl` is changing whether the special members are defaulted/trivial. I'm not sure if this actually fixes anything but it's more correct than what we did before. Repository: rLLDB LLDB https://reviews.llvm.org/D72698 Files: lldb/source/Symbol/ClangASTContext.cpp Index: lldb/source/Symbol/ClangASTContext.cpp =================================================================== --- lldb/source/Symbol/ClangASTContext.cpp +++ lldb/source/Symbol/ClangASTContext.cpp @@ -7259,7 +7259,6 @@ cxx_method_decl->setParams(llvm::ArrayRef<clang::ParmVarDecl *>(params)); - cxx_record_decl->addDecl(cxx_method_decl); // Sometimes the debug info will mention a constructor (default/copy/move), // destructor, or assignment operator (copy/move) but there won't be any @@ -7295,6 +7294,8 @@ VerifyDecl(cxx_method_decl); #endif + cxx_record_decl->addDecl(cxx_method_decl); + return cxx_method_decl; }
Index: lldb/source/Symbol/ClangASTContext.cpp =================================================================== --- lldb/source/Symbol/ClangASTContext.cpp +++ lldb/source/Symbol/ClangASTContext.cpp @@ -7259,7 +7259,6 @@ cxx_method_decl->setParams(llvm::ArrayRef<clang::ParmVarDecl *>(params)); - cxx_record_decl->addDecl(cxx_method_decl); // Sometimes the debug info will mention a constructor (default/copy/move), // destructor, or assignment operator (copy/move) but there won't be any @@ -7295,6 +7294,8 @@ VerifyDecl(cxx_method_decl); #endif + cxx_record_decl->addDecl(cxx_method_decl); + return cxx_method_decl; }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits