This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Add MacroQualified case for FunctionTypeUnwrapper
ClosedPublic

Authored by leonardchan on Sep 24 2019, 3:27 PM.

Details

Summary

This is a fix for PR43315. An assertion error is hit for this minimal example:

//clang -cc1 -triple x86_64-- -S tstVMStructRC-min.cpp
#define a __attribute__((__cdecl__, __regparm__(0))) 
int (a b)();  // Assertion `Chunk.Kind == DeclaratorChunk::Function' failed.

This is because we do not cover the case in the FunctionTypeUnwrapper where it receives a MacroQualifiedType. We have not run into this earlier because this is a unique case where the __attribute__ contains both __cdecl__ and __regparm__ (in that order), and we are compiling for x86_64. Changing the architecture or the order of __cdecl__ and __regparm__ does not raise the assertion.

Diff Detail

Event Timeline

leonardchan created this revision.Sep 24 2019, 3:27 PM
dim added a comment.Sep 25 2019, 2:19 AM

This works for me, and also for the original test case from https://bugs.freebsd.org/240764.

leonardchan retitled this revision from [Sema] Add FunctionTypeUnwrapper to [Sema] Add MacroQualified case for FunctionTypeUnwrapper.Sep 25 2019, 10:27 AM
jkim added a subscriber: jkim.Oct 17 2019, 1:01 PM
rsmith accepted this revision.Nov 12 2019, 4:06 PM
This revision is now accepted and ready to land.Nov 12 2019, 4:06 PM
This revision was automatically updated to reflect the committed changes.