This is an archive of the discontinued LLVM Phabricator instance.

Move decl context dumping to TextNodeDumper
ClosedPublic

Authored by steveire on Jan 17 2019, 1:12 AM.

Diff Detail

Repository
rC Clang

Event Timeline

steveire created this revision.Jan 17 2019, 1:12 AM

It appears we have no test coverage for this case -- can you introduce some?

lib/AST/ASTDumper.cpp
507–508

Might as well clean this up to be if (const auto *DC = dyn_cast<DeclContext>(D))

514–515

Why did this condition get dropped?

1233

Why is the isa<> test needed? D must be an ObjCMethodDecl which inherits from DeclContext, so this seems unneeded.

lib/AST/TextNodeDumper.cpp
260

const auto *

262

const auto *

steveire marked an inline comment as done.Jan 17 2019, 6:23 AM

I don't know what C++ code results in the undeserialized declarations output. Can you suggest some?

lib/AST/ASTDumper.cpp
514–515

The condition is using internal knowledge of the dumpDeclContext method - that it doesn't do anything if these conditions are not met, so avoid calling the method in the first place. We can just call the method. The for loop which remains will simply do nothing.

I don't know what C++ code results in the undeserialized declarations output. Can you suggest some?

I haven't the foggiest idea. I'd recommend doing an svn blame to see what commit added that code and try to work backwards from there -- presumably there's some related test code that could be run under -ast-dump.

lib/AST/ASTDumper.cpp
514–515

Ah, I see what's happening now, thank you.

aaron.ballman accepted this revision.Jan 18 2019, 7:07 AM

LGTM aside from the testing situation -- so long as the tests come out without changes, this is good to go. If there is a change in test behavior, let's do another round of review just to verify everyone's happy with the behavioral change.

lib/AST/ASTDumper.cpp
1233

Since this is just formatting changes unrelated to the patch, feel free to revert and commit separately for commit hygiene.

This revision is now accepted and ready to land.Jan 18 2019, 7:07 AM
steveire updated this revision to Diff 182607.Jan 18 2019, 2:23 PM
steveire marked an inline comment as done.

Update

aaron.ballman accepted this revision.Jan 18 2019, 4:02 PM

LGTM! At some point, we may want to revisit how we dump TranslationUnitDecl to make it a bit less inscrutable (I have no idea what those "invalid sloc" strings are telling me). At that point, we may want to turn <undeserialized declarations> into undeserialized_declarations as well so it stands out a bit more.

This revision was automatically updated to reflect the committed changes.

It looks like this change broke a number of the LLDB tests:

lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/781

Could you look into this or revert the change, so that the bot can go back to green?