On Oct 11, 2011, at 7:58 AM, Rafael Ávila de Espíndola wrote:
> I have sent this from the wrong address, sorry if you have two copies.
>
> This patch makes clang add the returns_twice attribute to functions that are
> known to have it.
>
> The list of functions is taken from llvm's callsFunctionThatReturnsTwice
> plus the __sigsetjmp as reported Khaled.
>
> The hope is that we can simplify callsFunctionThatReturnsTwice to check
> only for the attribute.
>
> Is the patch OK?
I see that the returns_twice attribute to be part of the function type, such
that a returns_twice function type is distinct from a non-returns_twice
function type. You've updated type merging for C so that we can cope with, e.g.,
int (*fptr)(jmp_buf) = &setjmp;
in C, but you'll need similar logic for C++'s overload resolution in
SemaOverload.cpp. See, for example, what we've done with noreturn to handle
function pointer conversions.
Alternatively, we could take returns_twice out of the type system entirely. Is
there value in declaring a function pointer to a returns_twice function, and
having that be a distinct type from a similar function pointer to any function?
If not, then perhaps returns_twice should be just a declaration attribute, and
not have any impact on the type system.
- Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits