[all-commits] [llvm/llvm-project] f6a561: DebugInfo: Use clang's preferred names for integer...

David Blaikie via All-commits all-commits at lists.llvm.org
Wed Oct 6 16:02:50 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f6a561c4d6754b13165a49990e8365d819f64c86
      https://github.com/llvm/llvm-project/commit/f6a561c4d6754b13165a49990e8365d819f64c86
  Author: David Blaikie <dblaikie at gmail.com>
  Date:   2021-10-06 (Wed, 06 Oct 2021)

  Changed paths:
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/test/CodeGen/aarch64-debug-sve-vector-types.c
    M clang/test/CodeGen/aarch64-debug-sve-vectorx2-types.c
    M clang/test/CodeGen/aarch64-debug-sve-vectorx3-types.c
    M clang/test/CodeGen/aarch64-debug-sve-vectorx4-types.c
    M clang/test/CodeGen/debug-info-enum.cpp
    M clang/test/CodeGen/debug-info.c
    M clang/test/CodeGenCXX/debug-info-enum-class.cpp
    M clang/test/CodeGenObjC/objc-fixed-enum.m
    M lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp
    M llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
    M llvm/test/CodeGen/MIR/X86/diexpr-win32.mir
    M llvm/test/DebugInfo/COFF/types-basic.ll
    A llvm/test/DebugInfo/COFF/types-integer-old.ll

  Log Message:
  -----------
  DebugInfo: Use clang's preferred names for integer types

This reverts c7f16ab3e3f27d944db72908c9c1b1b7366f5515 / r109694 - which
suggested this was done to improve consistency with the gdb test suite.
Possible that at the time GCC did not canonicalize integer types, and so
matching types was important for cross-compiler validity, or that it was
only a case of over-constrained test cases that printed out/tested the
exact names of integer types.

In any case neither issue seems to exist today based on my limited
testing - both gdb and lldb canonicalize integer types (in a way that
happens to match Clang's preferred naming, incidentally) and so never
print the original text name produced in the DWARF by GCC or Clang.

This canonicalization appears to be in `integer_types_same_name_p` for
GDB and in `TypeSystemClang::GetBasicTypeEnumeration` for lldb.

(I tested this with one translation unit defining 3 variables - `long`,
`long (*)()`, and `int (*)()`, and another translation unit that had
main, and a function that took `long (*)()` as a parameter - then
compiled them with mismatched compilers (either GCC+Clang, or
Clang+(Clang with this patch applied)) and no matter the combination,
despite the debug info for one CU naming the type "long int" and the
other naming it "long", both debuggers printed out the name as "long"
and were able to correctly perform overload resolution and pass the
`long int (*)()` variable to the `long (*)()` function parameter)

Did find one hiccup, identified by the lldb test suite - that CodeView
was relying on these names to map them to builtin types in that format.
So added some handling for that in LLVM. (these could be split out into
separate patches, but seems small enough to not warrant it - will do
that if there ends up needing any reverti/revisiting)

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




More information about the All-commits mailing list