This is an archive of the discontinued LLVM Phabricator instance.

Add __has_builtin support for builtin function-like type traits.
ClosedPublic

Authored by rsmith on Aug 12 2019, 11:26 AM.

Details

Summary

Previously __has_builtin(__builtin_*) would return false for
__builtin_*s that we modeled as keywords rather than as functions
(because they take type arguments). With this patch, all builtins
that are called with function-call-like syntax return true from
__has_builtin (covering __builtin_* and also the __is_* and __has_* type
traits and the handful of similar builtins without such a prefix).

Update the documentation on __has_builtin and on type traits to match.
While doing this I noticed the type trait documentation was out of date
and incomplete; that's fixed here too.

Diff Detail

Repository
rL LLVM

Event Timeline

rsmith created this revision.Aug 12 2019, 11:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2019, 11:26 AM
rsmith edited the summary of this revision. (Show Details)Aug 12 2019, 11:27 AM
aaron.ballman accepted this revision.Aug 12 2019, 1:12 PM

LGTM aside from some nits.

docs/LanguageExtensions.rst
65 ↗(On Diff #214673)

built-in -> builtin

(for consistency)

1120 ↗(On Diff #214673)

Drop the comma.

This revision is now accepted and ready to land.Aug 12 2019, 1:12 PM
rsmith marked 2 inline comments as done.Aug 13 2019, 7:29 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2019, 7:30 PM