LLVM 20.0.0git
Public Member Functions | List of all members
llvm::dwarf_linker::classic::CachedPathResolver Class Reference

Small helper that resolves and caches file paths. More...

#include "llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h"

Public Member Functions

StringRef resolve (const std::string &Path, NonRelocatableStringpool &StringPool)
 Resolve a path by calling realpath and cache its result.
 

Detailed Description

Small helper that resolves and caches file paths.

This helps reduce the number of calls to realpath which is expensive. We assume the input are files, and cache the realpath of their parent. This way we can quickly resolve different files under the same path.

Definition at line 34 of file DWARFLinkerDeclContext.h.

Member Function Documentation

◆ resolve()

StringRef llvm::dwarf_linker::classic::CachedPathResolver::resolve ( const std::string &  Path,
NonRelocatableStringpool StringPool 
)
inline

Resolve a path by calling realpath and cache its result.

The returned StringRef is interned in the given StringPool.

Definition at line 38 of file DWARFLinkerDeclContext.h.

References llvm::sys::path::append(), llvm::sys::path::filename(), llvm::sys::path::parent_path(), llvm::sys::fs::real_path(), and llvm::StringMap< ValueTy, AllocatorTy >::try_emplace().


The documentation for this class was generated from the following file: