This is an archive of the discontinued LLVM Phabricator instance.

[cfi] Fix missing !type annotation.
ClosedPublic

Authored by eugenis on Oct 31 2016, 2:18 PM.

Details

Reviewers
pcc
Summary

CFI (only in the cross-dso mode) fails to set !type annotations when
a function is used before it is defined.

Diff Detail

Repository
rL LLVM

Event Timeline

eugenis updated this revision to Diff 76479.Oct 31 2016, 2:18 PM
eugenis retitled this revision from to [cfi] Fix missing !type annotation..
eugenis updated this object.
eugenis added a reviewer: pcc.
eugenis set the repository for this revision to rL LLVM.
eugenis added a subscriber: cfe-commits.
pcc added inline comments.Oct 31 2016, 2:34 PM
lib/CodeGen/CodeGenModule.cpp
934

It looks like we can get here with declarations that are not of type FunctionDecl (mostly via SetInternalFunctionAttributes -- see http://llvm-cs.pcc.me.uk/tools/clang/lib/CodeGen/CodeGenModule.cpp/rSetInternalFunctionAttributes). I suppose that either means you would need to tolerate null pointers in CreateFunctionTypeMetadata or add an isa check here.

Please also add a test for one of those cases.

eugenis updated this revision to Diff 76489.Oct 31 2016, 3:08 PM
eugenis marked an inline comment as done.
pcc accepted this revision.Oct 31 2016, 3:12 PM
pcc edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 31 2016, 3:12 PM
eugenis closed this revision.Oct 31 2016, 3:43 PM

thanks!
r285650