This is an archive of the discontinued LLVM Phabricator instance.

[clang][Headers] Use __has_builtin instead of _MSC_VER.
ClosedPublic

Authored by Bigcheese on Mar 5 2020, 6:06 PM.

Details

Summary

arm_acle.h relied on _MSC_VER to determine if a given function was
already defined as a builtin. This was incorrect because
-fms-extensions enables these builtins, but is not responsible for
defining _MSC_VER on any target. The next closest thing is
_MSC_EXTENSIONS, which is only defined on Windows targets, but even
this is suboptimal. What this conditional is actually trying to
determine is if the given functions are defined as builtins, so just
check that directly.

I also attempted to do this for __nop, but in that case intrin.h,
which is only includable if _MSC_VER is defined, has its own
definition. So in that case _MSC_VER is correct.

rdar://60102353

Diff Detail

Event Timeline

Bigcheese created this revision.Mar 5 2020, 6:06 PM
kongyi accepted this revision.Mar 5 2020, 7:43 PM
This revision is now accepted and ready to land.Mar 5 2020, 7:43 PM
This revision was automatically updated to reflect the committed changes.