[Lldb-commits] [PATCH] D72698: [lldb] Add method decls to a CXXRecordDecl only after all their properties are defined
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Jan 14 05:26:17 PST 2020
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72698.237949.patch
Type: text/x-patch
Size: 650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200114/5435ffab/attachment-0001.bin>
More information about the lldb-commits
mailing list