[all-commits] [llvm/llvm-project] 75be04: [clang][DebugInfo] Emit debuginfo for non-constant...

yonghong-song via All-commits all-commits at lists.llvm.org
Wed Sep 28 12:11:26 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 75be0482a2e2a78fae83f1ca604f4ee20d673796
      https://github.com/llvm/llvm-project/commit/75be0482a2e2a78fae83f1ca604f4ee20d673796
  Author: Yonghong Song <yhs at fb.com>
  Date:   2022-09-28 (Wed, 28 Sep 2022)

  Changed paths:
    M clang/lib/CodeGen/CGStmt.cpp
    A clang/test/CodeGen/debug-info-enum-case-val.c

  Log Message:
  -----------
  [clang][DebugInfo] Emit debuginfo for non-constant case value

Currently, clang does not emit debuginfo for the switch stmt
case value if it is an enum value. For example,
  $ cat test.c
  enum { AA = 1, BB = 2 };
  int func1(int a) {
    switch(a) {
    case AA: return 10;
    case BB: return 11;
    default: break;
    }
    return 0;
  }
  $ llvm-dwarfdump test.o | grep AA
  $
Note that gcc does emit debuginfo for the same test case.

This patch added such a support with similar implementation
to CodeGenFunction::EmitDeclRefExprDbgValue(). With this patch,
  $ clang -g -c test.c
  $ llvm-dwarfdump test.o | grep AA
                  DW_AT_name    ("AA")
  $

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




More information about the All-commits mailing list