[all-commits] [llvm/llvm-project] 95f4b2: [GSYM] Fix the initialization of DataExtractor (#6...

Kazu Hirata via All-commits all-commits at lists.llvm.org
Sun Oct 1 12:11:24 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 95f4b2a70850b5e6ab83ec21af3fe5246cac0675
      https://github.com/llvm/llvm-project/commit/95f4b2a70850b5e6ab83ec21af3fe5246cac0675
  Author: Kazu Hirata <kazu at google.com>
  Date:   2023-10-01 (Sun, 01 Oct 2023)

  Changed paths:
    M llvm/lib/DebugInfo/GSYM/GsymReader.cpp

  Log Message:
  -----------
  [GSYM] Fix the initialization of DataExtractor (#67904)

Without this patch, we pass Endian as one of the parameters to the
constructor of DataExtractor.  The problem is that Endian is of:

  enum endianness {big, little, native};

whereas the constructor is expecting "bool IsLittleEndian".  That is,
we are relying on an implicit conversion to convert big and little to
false and true, respectively.

When we migrate llvm::support::endianness to std::endian in future, we
can no longer rely on an implicit conversion because std::endian is
declared with "enum class".  Even if we could, the conversion would
not be guaranteed to work because, for example, libcxx defines:

  enum class endian {
    little = 0xDEAD,
    big = 0xFACE,
    :

where big and little are not boolean values.

This patch fixes the problem by properly converting Endian to a
boolean value.




More information about the All-commits mailing list