This is an archive of the discontinued LLVM Phabricator instance.

Diagnose CXX "this" reference in functions with naked attr
ClosedPublic

Authored by weimingz on Feb 1 2015, 10:34 PM.

Details

Summary

Currently, clang will assert for non-static class member func with naked attribute because clang won't emit any prologues for such functions, so it would assert when it tries to codegen 'this' pointer

This patch fixes bug http://llvm.org/bugs/show_bug.cgi?id=22429

Diff Detail

Repository
rL LLVM

Event Timeline

weimingz updated this revision to Diff 19128.Feb 1 2015, 10:34 PM
weimingz retitled this revision from to Diagnose class member function with naked attr.
weimingz updated this object.
weimingz edited the test plan for this revision. (Show Details)
weimingz added a subscriber: Unknown Object (MLST).
weimingz updated this object.Feb 2 2015, 12:01 PM
rnk added a subscriber: rnk.Feb 2 2015, 2:04 PM

I think it would be preferable to extend the asm constraint checks to disallow CXXThisExpr.

hans edited edge metadata.Feb 2 2015, 2:18 PM

I think it would be preferable to extend the asm constraint checks to disallow CXXThisExpr.

Yes, I don't see why we would need to disallow naked member functions.

In D7329#117184, @hans wrote:

I think it would be preferable to extend the asm constraint checks to disallow CXXThisExpr.

Yes, I don't see why we would need to disallow naked member functions.

Agree. Will do

weimingz updated this revision to Diff 19199.Feb 2 2015, 3:59 PM
weimingz retitled this revision from Diagnose class member function with naked attr to Diagnose CXX "this" reference in functions with naked attr.
weimingz edited edge metadata.
weimingz updated this revision to Diff 19200.Feb 2 2015, 4:02 PM

(undo unnecessary change made in previous patch)

rnk accepted this revision.Feb 2 2015, 6:20 PM
rnk added a reviewer: rnk.

lgtm

include/clang/Basic/DiagnosticSemaKinds.td
7178 ↗(On Diff #19200)

We don't do smart backtick quotes like this.

This revision is now accepted and ready to land.Feb 2 2015, 6:20 PM
weimingz updated this revision to Diff 19243.Feb 3 2015, 10:22 AM
weimingz edited edge metadata.

Hi Hans,

Are you OK with the patch?

Thanks,
Weiming

hans accepted this revision.Feb 3 2015, 2:00 PM
hans edited edge metadata.

Hi Hans,

Are you OK with the patch?

Yes, this looks good to me.

This revision was automatically updated to reflect the committed changes.