This is an archive of the discontinued LLVM Phabricator instance.

[Clang][CodeGen] fix failed assertion
ClosedPublic

Authored by nickdesaulniers on Oct 23 2020, 1:07 PM.

Details

Summary

Ensure we can emit symbol aliases via function attribute
even when function signatures contain incomplete types.

Via bugreport:
https://reviews.llvm.org/D66492#2350947

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptOct 23 2020, 1:07 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
nickdesaulniers requested review of this revision.Oct 23 2020, 1:07 PM
erichkeane added inline comments.
clang/lib/CodeGen/CodeGenModule.cpp
4643

I'd suggest making this just 'else', that way you don't have to do the assert below. The first line of getFunctionLinkage does the cast to FunctionDecl, so that part is already taken care of.

aaron.ballman added inline comments.Oct 24 2020, 6:45 AM
clang/lib/CodeGen/CodeGenModule.cpp
4640

Rather than isa<> followed by cast<>, this should be using dyn_cast<>. e.g.,

if (const auto *VD = dyn_cast<VarDecl>(GD.getDecl()))
  ...
else
  ...
  • dyn_cast, else
nickdesaulniers marked 2 inline comments as done.
nickdesaulniers removed a subscriber: erichkeane.
erichkeane accepted this revision.Oct 26 2020, 10:43 AM

Please make sure the commit message is significantly more descriptive here than what is on the review.

This revision is now accepted and ready to land.Oct 26 2020, 10:43 AM
nickdesaulniers edited the summary of this revision. (Show Details)Oct 26 2020, 11:05 AM
This revision was landed with ongoing or failed builds.Oct 26 2020, 11:38 AM
This revision was automatically updated to reflect the committed changes.