[all-commits] [llvm/llvm-project] 00b1f7: Use TI.hasBuiltinAtomic() when setting ATOMIC_*_LO...

Alexander Richardson via All-commits all-commits at lists.llvm.org
Tue Nov 15 04:43:05 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 00b1f7a6ab2aecd2309e2faebde18a11309c6181
      https://github.com/llvm/llvm-project/commit/00b1f7a6ab2aecd2309e2faebde18a11309c6181
  Author: Alex Richardson <alexrichardson at google.com>
  Date:   2022-11-15 (Tue, 15 Nov 2022)

  Changed paths:
    M clang/lib/Frontend/InitPreprocessor.cpp

  Log Message:
  -----------
  Use TI.hasBuiltinAtomic() when setting ATOMIC_*_LOCK_FREE values. NFCI

I noticed that the values for __{CLANG,GCC}_ATOMIC_POINTER_LOCK_FREE were
incorrectly set to 1 instead of two in downstream CHERI targets because
pointers are handled specially there. While fixing this downstream, I
noticed that the existing code could be refactored to use
TargetInfo::hasBuiltinAtomic instead of repeating the almost identical
logic. In theory there could be a difference here since hasBuiltinAtomic() also
returns true for types less than 1 char in size, but since
InitializePredefinedMacros() never passes such a value this change should
not introduce any functional changes.

Reviewed By: rprichard, efriedma

Differential Revision: https://reviews.llvm.org/D135142




More information about the All-commits mailing list