Skip to content
Commit bbab17c6 authored by Yonghong Song's avatar Yonghong Song
Browse files

[Clang][Attr] fix a btf_type_attr CGDebugInfo codegen bug

Nathan Chancellor reported a crash due to commit
3466e007 (Reland "[Attr] support btf_type_tag attribute").

The following test can reproduce the crash:
  $ cat efi.i
  typedef unsigned long efi_query_variable_info_t(int);
  typedef struct {
    struct {
      efi_query_variable_info_t __attribute__((regparm(0))) * query_variable_info;
    };
  } efi_runtime_services_t;
  efi_runtime_services_t efi_0;
  $ clang -m32 -O2 -g -c -o /dev/null efi.i

The reason is that FunctionTypeLoc.getParam(Idx) may return a
nullptr which should be checked before dereferencing the
result pointer. This patch fixed this issue.
parent d9e2c8f5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment