|
FE 0.13.1
Header-only C++ frontend library
|
Interns the text - and the std::filesystem::path - of every file a Loc may point into. More...
#include <fe/src.h>
Register a File | |
| std::pair< const Src *, bool > | add (std::filesystem::path path, std::string buf) |
| std::pair< const Src *, bool > | add (std::filesystem::path path) |
As above, but reads the content from path. | |
| static std::string | slurp (std::istream &is) |
Reads all of is into a std::string. | |
Lookup | |
| const Src * | lookup (const std::filesystem::path &path) const |
| static std::filesystem::path | key (const std::filesystem::path &path) |
The key path is interned under - absolute, symlink-free, and normalized. | |
Interns the text - and the std::filesystem::path - of every file a Loc may point into.
Keep one in your Driver: a Loc is only as good as the SrcMap that keeps its Src alive. Each file lives here exactly once, so Loc::src identifies it by pointer - see SrcMap::key.
|
inline |
|
inline |
Registers path with buf as its content and reports whether it is fresh. A path with the same SrcMap::key as an already registered one yields that entry instead.
Definition at line 139 of file src.h.
References key().
|
inlinestatic |
The key path is interned under - absolute, symlink-free, and normalized.
This is where "do these two paths name the same file?" is decided - once, upon SrcMap::add - so that every comparison afterwards is a plain Loc::src pointer comparison.
path exists on disk and normalizes the rest lexically. A relative path is resolved against the current working directory now.
|
inline |
path has not been registered. path that merely spells a registered file differently still finds it. Definition at line 167 of file src.h.
References fe::Src::end(), and key().
|
inlinestatic |