This is an archive of the discontinued LLVM Phabricator instance.

PR20958 Allow redeclaration of type-generic builtins
Needs ReviewPublic

Authored by chatur01 on May 21 2015, 7:43 AM.

Details

Summary

This patch allows the user to declare the C99 math builtins that take the generic "real-floating" argument types.
A use case is described in https://llvm.org/bugs/show_bug.cgi?id=20958 -- this is preventing Clang from being used to build Android.

In C++98 and C89, you may redeclare these builtins to take any type, Clang will pretend these don't exist in these languages.
In C++11 and C99 (and derivations thereof), you can only redeclare the builtin with types that are "real-floating". If you try to redeclare with different types, a diagnostic is produced.

I also tweaked the __noop builtin to specify that it's arguments are custom type-checked. This was avoid a semantic error about passing non-POD types through a variadic argument, which is not appropriate for that builtin.

Diff Detail

Event Timeline

chatur01 retitled this revision from to PR20958 Allow redeclaration of type-generic builtins.
chatur01 updated this object.
chatur01 edited the test plan for this revision. (Show Details)
chatur01 set the repository for this revision to rL LLVM.
chatur01 added a subscriber: Unknown Object (MLST).

Ping. Should make it clearer that this must be committed after D9913.

chatur01 removed rL LLVM as the repository for this revision.

Handle signbit as well.

Hi! Thanks for this patch.

We're building Android6 with Clang (in order to apply static analyzer on it), and without this patch we've 613 build failures. This patch helps to get rid of 521 of those build failures (85%).

"Works for me".

lib/Sema/SemaDecl.cpp
1758

Trailing space

1763

Ditto

1775

Ditto

1837

Ditto