This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Fix crash in getConstructorName.
ClosedPublic

Authored by ilya-biryukov on Jul 3 2018, 6:52 AM.

Details

Summary

Can happen when getConstructorName is called on invalid decls,
specifically the ones that do not have the injected class name.

Diff Detail

Event Timeline

ilya-biryukov created this revision.Jul 3 2018, 6:52 AM
rsmith added a comment.Jul 3 2018, 2:44 PM

Looks fine, but please put the test case somewhere more appropriate (under SemaCXX, for instance).

lib/Sema/SemaExprCXX.cpp
117

We would be able to recover in more cases if we only bail out when the InjectedClassName is not found. Maybe instead of this change, you could weaken the assertion to only fail if the class is valid, and return ParsedType here if we don't find an InjectedClassName.

rsmith accepted this revision.Jul 3 2018, 2:44 PM
This revision is now accepted and ready to land.Jul 3 2018, 2:44 PM
ilya-biryukov marked an inline comment as done.
  • Better recovery for invalid decls that do have an injected class name
  • Move the test to SemaCXX

Thanks for taking a look!

This revision was automatically updated to reflect the committed changes.