[all-commits] [llvm/llvm-project] 8bf124: DebugInfo: workaround for context-sensitive use of...

David Blaikie via All-commits all-commits at lists.llvm.org
Mon Nov 1 17:09:04 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8bf12445383b2f3149a9d095bfbc0f6d5b00dfaa
      https://github.com/llvm/llvm-project/commit/8bf12445383b2f3149a9d095bfbc0f6d5b00dfaa
  Author: David Blaikie <dblaikie at gmail.com>
  Date:   2021-11-01 (Mon, 01 Nov 2021)

  Changed paths:
    M clang/include/clang/AST/DeclTemplate.h
    M clang/include/clang/AST/PrettyPrinter.h
    M clang/lib/AST/DeclPrinter.cpp
    M clang/lib/AST/DeclTemplate.cpp
    M clang/lib/AST/Expr.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/test/CodeGenCXX/debug-info-template.cpp
    M clang/test/Modules/lsv-debuginfo.cpp
    M libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp

  Log Message:
  -----------
  DebugInfo: workaround for context-sensitive use of non-type-template-parameter integer suffixes

There's a nuanced check about when to use suffixes on these integer
non-type-template-parameters, but when rebuilding names for
-gsimple-template-names there isn't enough data in the DWARF to
determine when to use suffixes or not. So turn on suffixes always to
make it easy to match up names in llvm-dwarfdump --verify.

I /think/ if we correctly modelled auto non-type-template parameters
maybe we could put suffixes only on those. But there's also some logic
in Clang that puts the suffixes on overloaded functions - at least
that's what the parameter says (see D77598 and printTemplateArguments
"TemplOverloaded" parameter) - but I think maybe it's for anything that
/can/ be overloaded, not necessarily only the things that are overloaded
(the argument value is hardcoded at the various callsites, doesn't seem
to depend on overload resolution/searching for overloaded functions). So
maybe with "auto" modeled more accurately, and differentiating between
function templates (always using type suffixes there) and class/variable
templates (only using the suffix for "auto" types) we could correctly
use integer type suffixes only in the minimal set of cases.

But that seems all too much fuss, so let's just put integer type
suffixes everywhere always in the debug info of integer non-type
template parameters in template names.

(more context:
* https://reviews.llvm.org/D77598#inline-1057607
* https://groups.google.com/g/llvm-dev/c/ekLMllbLIZg/m/-dhJ0hO1AAAJ )

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




More information about the All-commits mailing list