)]}'
{
  "commit": "d72c8b02802c87386f5db3c7de6c79e921618fa3",
  "tree": "51f37accee4844869b4b6eba7e4ddaba5b387fd0",
  "parents": [
    "5430f73b501f9fc0a38c3768592f5f31bcbdf2f0"
  ],
  "author": {
    "name": "Michael Buch",
    "email": "michaelbuch12@gmail.com",
    "time": "Mon Jul 29 09:35:00 2024 +0100"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Mon Jul 29 09:35:00 2024 +0100"
  },
  "message": "[lldb][TypeSystemClang] Create VLAs of explicitly 0-size as ConstantArrayType (#100710)\n\nDepends on https://github.com/llvm/llvm-project/pull/100674\r\n\r\nCurrently, we treat VLAs declared as `int[]` and `int[0]` identically.\r\nI.e., we create them as `IncompleteArrayType`s. However, the\r\n`DW_AT_count` for `int[0]` *does* exist, and is retrievable without an\r\nexecution context. This patch decouples the notion of \"has 0 elements\"\r\nfrom \"has no known `DW_AT_count`\".\r\n\r\nThis aligns with how Clang represents `int[0]` in the AST (it treats it\r\nas a `ConstantArrayType` of 0 size).\r\n\r\nThis issue was surfaced when adapting LLDB to\r\nhttps://github.com/llvm/llvm-project/issues/93069. There, the\r\n`__compressed_pair_padding` type has a `char[0]` member. If we\r\npreviously got the `__compressed_pair_padding` out of a module (where\r\nclang represents `char[0]` as a `ConstantArrayType`), and try to merge\r\nthe AST with one we got from DWARF (where LLDB used to represent\r\n`char[0]` as an `IncompleteArrayType`), the AST structural equivalence\r\ncheck fails, resulting in silent ASTImporter failures. This manifested\r\nin a failure in `TestNonModuleTypeSeparation.py`.\r\n\r\n**Implementation**\r\n1. Adjust `ParseChildArrayInfo` to store the element counts of each VLA\r\ndimension as an `optional\u003cuint64_t\u003e`, instead of a regular `uint64_t`.\r\nSo when we pass this down to `CreateArrayType`, we have a better\r\nheuristic for what is an `IncompleteArrayType`.\r\n2. In `TypeSystemClang::GetBitSize`, if we encounter a\r\n`ConstantArrayType` simply return the size that it was created with. If\r\nwe couldn\u0027t determine the authoritative bound from DWARF during parsing,\r\nwe would\u0027ve created an `IncompleteArrayType`. This ensures that\r\n`GetBitSize` on arrays with `DW_AT_count 0x0` returns `0` (whereas\r\npreviously it would\u0027ve returned a `std::nullopt`, causing that\r\n`FieldDecl` to just get dropped during printing)",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "d20766788192f7d23eef9e52fb94e95f53c237e7",
      "old_mode": 33188,
      "old_path": "lldb/include/lldb/Symbol/SymbolFile.h",
      "new_id": "8419495da73a22b990738dac646f22b758d883a4",
      "new_mode": 33188,
      "new_path": "lldb/include/lldb/Symbol/SymbolFile.h"
    },
    {
      "type": "modify",
      "old_id": "409e9bb37ab28b9719b0ca074d8adfc61567431e",
      "old_mode": 33188,
      "old_path": "lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp",
      "new_id": "4ed523bbb9e7600336e6cc9367e77fdd48831ee1",
      "new_mode": 33188,
      "new_path": "lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp"
    },
    {
      "type": "modify",
      "old_id": "85c59a605c675c8d677ff3e2f067ce7f17048e32",
      "old_mode": 33188,
      "old_path": "lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp",
      "new_id": "a4dcde1629fc214a6f9c2785f73ad5f0ab6c62e8",
      "new_mode": 33188,
      "new_path": "lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp"
    },
    {
      "type": "modify",
      "old_id": "0386e3b261c55c60aeabfe5802f11c9fe955a29f",
      "old_mode": 33188,
      "old_path": "lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp",
      "new_id": "484ca04fe04c9eedf72b4743cf59b608e8d020e5",
      "new_mode": 33188,
      "new_path": "lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp"
    },
    {
      "type": "modify",
      "old_id": "70722eb375ab76e240aa7d8552824a66599bd6cc",
      "old_mode": 33188,
      "old_path": "lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h",
      "new_id": "56a5c0a516706d07153697ed347071ad004fa4fd",
      "new_mode": 33188,
      "new_path": "lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h"
    },
    {
      "type": "modify",
      "old_id": "e683c491089762be986167c2af6dd205241ea0ba",
      "old_mode": 33188,
      "old_path": "lldb/test/API/lang/c/struct_types/main.c",
      "new_id": "70217c57bec5f0bef23ac14ef0eeec7909b76e6e",
      "new_mode": 33188,
      "new_path": "lldb/test/API/lang/c/struct_types/main.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "344b100efd9f96b66d2d0274c89bbd9ce8e96caa",
      "new_mode": 33188,
      "new_path": "lldb/test/Shell/SymbolFile/DWARF/vla.cpp"
    }
  ]
}
