[all-commits] [llvm/llvm-project] 9e24d1: [llvm][vfs] NFC: Virtualize in-memory `getStatus`

Jan Svoboda via All-commits all-commits at lists.llvm.org
Thu Jan 20 06:48:19 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e24d14ac89f44bb6c9141561ca849ccdd09e6a8
      https://github.com/llvm/llvm-project/commit/9e24d14ac89f44bb6c9141561ca849ccdd09e6a8
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-01-20 (Thu, 20 Jan 2022)

  Changed paths:
    M llvm/lib/Support/VirtualFileSystem.cpp

  Log Message:
  -----------
  [llvm][vfs] NFC: Virtualize in-memory `getStatus`

This patch virtualizes the `getStatus` function on `InMemoryNode` in LLVM VFS. Currently, this is implemented via top-level function `getNodeStatus` that tries to cast `InMemoryNode *` into each subtype. Virtual functions seem to be the simpler solution here.

Reviewed By: dexonsmith

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


  Commit: 9011903e3613af360c3a1d05c106e464538efd08
      https://github.com/llvm/llvm-project/commit/9011903e3613af360c3a1d05c106e464538efd08
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-01-20 (Thu, 20 Jan 2022)

  Changed paths:
    M llvm/include/llvm/Support/VirtualFileSystem.h
    M llvm/lib/Support/VirtualFileSystem.cpp

  Log Message:
  -----------
  [llvm][vfs] Abstract in-memory node creation

The creation of in-memory VFS nodes happens in a single function that deduces what kind of node to create from the arguments. This leads to complicated if-then-else logic that's difficult to cleanly extend.

This patch abstracts away in-memory node creation via a type-erased factory function that's passed instead.

Reviewed By: dexonsmith

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


Compare: https://github.com/llvm/llvm-project/compare/6d45284618f0...9011903e3613


More information about the All-commits mailing list