)]}'
{
  "commit": "d95dadff8f094e793b79eec57737ec397fad7724",
  "tree": "85379c667e0d79de746db4a2766ce69aac3a9b20",
  "parents": [
    "df71243fa885cd3db701dc35a0c8d157adaf93b3"
  ],
  "author": {
    "name": "nerix",
    "email": "nerixdev@outlook.de",
    "time": "Mon Aug 04 09:56:04 2025 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Mon Aug 04 08:56:04 2025 +0100"
  },
  "message": "[LLDB][NativePDB] Allow type lookup in namespaces (#149876)\n\nPreviously, `type lookup` for types in namespaces didn\u0027t work with the\nnative PDB plugin, because `FindTypes` would only look for types whose\nbase name was equal to their full name. PDB/CodeView does not store the\nbase names in the TPI stream, but the types have their full name (e.g.\n`std::thread` instead of `thread`). So `findRecordsByName` would only\nreturn types in the top level namespace.\n\nThis PR changes the lookup to go through all types and check their base\nname. As that could be a bit expensive, the names are first cached\n(similar to the function lookup in the DIA PDB plugin). Potential types\nare checked with `TypeQuery::ContextMatches`.\n\nTo be able to handle anonymous namespaces, I changed\n`TypeQuery::ContextMatches`. The [`TypeQuery`\nconstructor](https://github.com/llvm/llvm-project/blob/9ad7edef4276207ca4cefa6b39d11145f4145a72/lldb/source/Symbol/Type.cpp#L76-L79)\ninserts all name components as `CompilerContextKind::AnyDeclContext`. To\nskip over anonymous namespaces, `ContextMatches` checked if a component\nwas empty and exactly of kind `Namespace`. For our query, the last check\nwas always false, so we never skipped anonymous namespaces. DWARF\ndoesn\u0027t have this problem, as it [constructs the context\noutside](https://github.com/llvm/llvm-project/blob/abe93d9d7e891a2a6596ddb0c6324280137c89dc/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp#L154-L160)\nand has proper information about namespaces. I\u0027m not fully sure if my\nchange is correct and that it doesn\u0027t break other users of `TypeQuery`.\n\nThis enables `type lookup \u003ctype\u003e` to work on types in namespaces.\nHowever, expressions don\u0027t work with this yet, because `FindNamespace`\nis unimplemented for native PDB.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "98b965c361a77cb2e439d67541057a3035230f53",
      "old_mode": 33188,
      "old_path": "lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h",
      "new_id": "36e075b04f26f727e1532e9a7e01f91fcbc5a124",
      "new_mode": 33188,
      "new_path": "lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h"
    },
    {
      "type": "modify",
      "old_id": "20d8c1acf9c4256d71d6465ab21cbddd64030a3e",
      "old_mode": 33188,
      "old_path": "lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp",
      "new_id": "7af53e16ce9d5a9ef31559916fe11034cb6d108f",
      "new_mode": 33188,
      "new_path": "lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp"
    },
    {
      "type": "modify",
      "old_id": "9891313f11d0bf69f2d9158ca8657d3a8df20269",
      "old_mode": 33188,
      "old_path": "lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h",
      "new_id": "eda375d4cebe73ac538feec44463f0f509e22fbe",
      "new_mode": 33188,
      "new_path": "lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h"
    },
    {
      "type": "modify",
      "old_id": "b7adae41b519012e0b3b58bded4965998f5633b8",
      "old_mode": 33188,
      "old_path": "lldb/source/Symbol/Type.cpp",
      "new_id": "952b2bdee18862184f256dd9b48fadfea49c6d33",
      "new_mode": 33188,
      "new_path": "lldb/source/Symbol/Type.cpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "f6c1ccf22fa1819e371340d88f77462a481fac5d",
      "new_mode": 33188,
      "new_path": "lldb/test/Shell/SymbolFile/NativePDB/namespace-access.test"
    }
  ]
}
