This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Avoid crash on tag-type mismatch (Fixes PR24610)
ClosedPublic

Authored by vsk on Aug 28 2015, 11:51 AM.

Details

Summary

We currently assert-fail on the following input:

enum Color { R, G, B };
typedef struct Color C;

This patch makes setTagNameForLinkagePurposes return early if the declaration is invalid.

https://llvm.org/bugs/show_bug.cgi?id=24610

Diff Detail

Repository
rL LLVM

Event Timeline

vsk updated this revision to Diff 33453.Aug 28 2015, 11:51 AM
vsk retitled this revision from to [Sema] Avoid crash on tag-type mismatch (Fixes PR24610).
vsk updated this object.
vsk added a subscriber: cfe-commits.
majnemer edited edge metadata.Aug 31 2015, 12:52 PM

I think it'd be nice if we keep the assert but make setTagNameForLinkagePurposes early-return if TagFromDeclSpec->isInvalidDecl() returns true. How does that sound to you?

vsk updated this revision to Diff 33623.Aug 31 2015, 1:44 PM
vsk updated this object.
vsk edited edge metadata.
  • Keep the assert, return early if the declaration is invalid.
majnemer accepted this revision.Sep 1 2015, 6:50 PM
majnemer edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 1 2015, 6:50 PM
This revision was automatically updated to reflect the committed changes.