This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add method decls to a CXXRecordDecl only after all their properties are defined
Needs ReviewPublic

Authored by teemperor on Jan 14 2020, 5:23 AM.

Details

Reviewers
shafik
Summary

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.

Diff Detail

Event Timeline

teemperor created this revision.Jan 14 2020, 5:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2020, 5:23 AM
kwk added a subscriber: kwk.Apr 20 2020, 10:22 PM

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.

But at least you return immediately after calling addDecl.

When trying to see what VerifyDecl(cxx_method_decl) does, I noticed that I don't have a ClangASTContext.cpp in my source tree. Even grepping for the file in the last 400 revisions didn't show it: git log --stat -n400 | grep ClangASTContext.cpp. No luck with github as well: https://github.com/llvm/llvm-project/search?q=ClangASTContext.cpp&unscoped_q=ClangASTContext.cpp. Is that expected?