This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Get rid of unused default argument to Sema::CheckCallingConvAttr.
AbandonedPublic

Authored by jlebar on Jan 3 2017, 6:09 PM.

Details

Reviewers
rnk
Summary

All callers of CheckCallingConvAttr passed FD == nullptr, so just get
rid of the aspirational function arg.

Event Timeline

jlebar updated this revision to Diff 82987.Jan 3 2017, 6:09 PM
jlebar retitled this revision from to [Sema] Get rid of unused default argument to Sema::CheckCallingConvAttr..
jlebar updated this object.
jlebar added a reviewer: rnk.
jlebar added a subscriber: cfe-commits.
rnk edited edge metadata.Jan 4 2017, 8:17 AM

I think you've discovered this bug:

struct F { void __attribute__((pcs("aapcs"))) f(); };
void __attribute__((pcs("aapcs"))) F::f() {}

Clang ignores the pcs convention on 32-bit x86, and because we don't have an FD here, we choose the wrong default calling convention (not thiscall) for F::f.

jlebar abandoned this revision.Jan 4 2017, 10:37 AM

I think you've discovered this bug:

Hm, I guess this is a step in the wrong direction, then.

(I spun this patch after writing some code in this function that assumed I'd get a FunctionDecl where appropriate, which of course doesn't work.)

Thanks for the review, Reid.

rnk added a comment.Jan 4 2017, 11:03 AM

In general we can't get an FD here because we might be in the middle of parsing the declarator. The calls from SemaType.cpp in particular can't actually provide one. They would have to thread through the IsVariadic and IsCXXMethod bools based on syntactic cues (the ellipsis, member pointer declarator chunks, being the appropriate declarator chunk in a record context, i.e. what getCCForDeclaratorChunk does).