Page MenuHomePhabricator

Add assert for 'bad' code path in GetUniqueNamespaceDeclaration

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



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

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
1957 ↗(On Diff #208075)

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.
1957 ↗(On Diff #208075)

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
1957 ↗(On Diff #208075)

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