[all-commits] [llvm/llvm-project] a52e9e: [Preprocessor] Fix __has_builtin for CPU ID functi...

Nemanja Ivanovic via All-commits all-commits at lists.llvm.org
Fri Feb 2 01:49:57 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a52e9eca3001b23c7952300e5a32b5c58ef2e0e2
      https://github.com/llvm/llvm-project/commit/a52e9eca3001b23c7952300e5a32b5c58ef2e0e2
  Author: Nemanja Ivanovic <nemanja.i.ibm at gmail.com>
  Date:   2024-02-02 (Fri, 02 Feb 2024)

  Changed paths:
    M clang/lib/Lex/PPMacroExpansion.cpp
    A clang/test/Preprocessor/has_builtin_cpuid.c

  Log Message:
  -----------
  [Preprocessor] Fix __has_builtin for CPU ID functions (#80058)

My recent commit (67c1c1d) made the CPU ID builtins target-independent
so they can be used on PPC as well. However, that had the unintended
consequence of changing the behaviour of __has_builtin in that it
reports these as supported at the pre-processor level. This makes it
impossible to guard the use of these with this feature test macro which
is clearly not ideal.
This patch restores the behaviour of __has_builtin for __builtin_cpu_is,
__builtin_cpu_init,
__builtin_cpu_supports. Now the preprocessor queries the target to
determine whether the target supports the builtin.




More information about the All-commits mailing list