This is an archive of the discontinued LLVM Phabricator instance.

Add assert for 'bad' code path in GetUniqueNamespaceDeclaration
ClosedPublic

Authored by teemperor on Feb 7 2019, 1:56 AM.

Details

Summary

If we call this function with a non-namespace as a second argument (and a nullptr name), we currently
only get a nullptr as a return when we hit the "Bad!!!" code path. This patch just adds an assert as this
seems to be a programming error in the calling code.

Diff Detail

Repository
rL LLVM

Event Timeline

teemperor created this revision.Feb 7 2019, 1:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2019, 1:56 AM
teemperor updated this revision to Diff 208073.Jul 4 2019, 12:48 PM
  • rebase patch to monorepo
This revision was not accepted when it landed; it landed in state Needs Review.Jul 4 2019, 12:50 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 4 2019, 12:50 PM
shafik added inline comments.Jul 8 2019, 2:28 PM
lldb/trunk/source/Symbol/ClangASTContext.cpp
1957

We don't have a way to trigger this branch?

davide added a subscriber: davide.Jul 8 2019, 2:44 PM
davide added inline comments.
lldb/trunk/source/Symbol/ClangASTContext.cpp
1957

I guess this is the whole point of the assertion. It can't be hit. BTW, you can replace it with llvm_unreachable()

davide added inline comments.Jul 8 2019, 2:56 PM
lldb/trunk/source/Symbol/ClangASTContext.cpp
1957

"can't" in this context is a very strong word. It shouldn't. If it gets hit, we should remove the assertion.