[Lldb-commits] [PATCH] D148541: [lldb] fix build issue on MSVC because of missing byte-swap builtins

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 17 11:14:50 PDT 2023


bulbazord requested changes to this revision.
bulbazord added a comment.
This revision now requires changes to proceed.

Instead of not using `__builtin_bswap{32,64}` entirely, we should check if they're available.

You can use the clang feature-checking macro `__has_builtin` (and if it doesn't exist you can define it). So you could amend this patch like so:

  #if !defined(__has_builtin)
  #define __has_builtin(x) 0
  #endif
  
  #if __has_builtin(__builtin_bswap32)
  #define bswap_32(x) __builtin_bswap32(x)
  #elif _MSC_VER
  #define bswap_32(x) _byteswap_ulong(x)
  #else
  #include <byteswap.h>
  #endif




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148541/new/

https://reviews.llvm.org/D148541



More information about the lldb-commits mailing list