[all-commits] [llvm/llvm-project] 16af23: [clang][Headers] Use __has_builtin instead of _MSC...

Michael Spencer via All-commits all-commits at lists.llvm.org
Fri Mar 6 13:48:30 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 16af23fae8ad2949048e0fc34cf9114dfbe4742a
      https://github.com/llvm/llvm-project/commit/16af23fae8ad2949048e0fc34cf9114dfbe4742a
  Author: Michael Spencer <bigcheesegs at gmail.com>
  Date:   2020-03-06 (Fri, 06 Mar 2020)

  Changed paths:
    M clang/lib/Headers/arm_acle.h
    M clang/test/Headers/arm-acle-header.c

  Log Message:
  -----------
  [clang][Headers] Use __has_builtin instead of _MSC_VER.

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.

Differential Revision: https://reviews.llvm.org/D75719
rdar://60102353




More information about the All-commits mailing list