#include <context.h>
Context storing compiler-wide state
◆ Context()
Context::Context |
( |
Options |
options | ) |
|
|
explicit |
- Parameters
-
options | options to use for code compilation |
◆ ~Context()
◆ cacheUnit()
void Context::cacheUnit |
( |
std::shared_ptr< Unit > |
unit | ) |
|
Caches a code unit inside the context. The cache uses a unit's (ID, path)
tuple as the index. Any previously cached unit with the same index tuple will be replaced.
- Parameters
-
- Returns
- the meta data associated with the newly registered module
◆ dumpUnitCache()
Dumps the current state of the unit cache to a debug stream.
- Parameters
-
stream | debug stream to write to |
◆ lookupDependenciesForUnit()
std::vector< std::weak_ptr< Unit > > Context::lookupDependenciesForUnit |
( |
const ID & |
id, |
|
|
const hilti::rt::filesystem::path & |
extension |
|
) |
| |
Returns all (direct & indirect) dependencies that a module imports. This information will be complete only once all AST have been fully resolved.
◆ lookupUnit() [1/2]
std::optional< CacheEntry > Context::lookupUnit |
( |
const ID & |
id, |
|
|
const hilti::rt::filesystem::path & |
extension |
|
) |
| |
Looks up a previously cached unit by its ID.
- Parameters
-
path | path to look up a unit for |
extension | a file extension expected for the unit, indicating its source language; a cached unit will only be returned if its extension matches |
- Returns
- the cache entry associated with the path if found
◆ lookupUnit() [2/2]
std::optional< CacheEntry > Context::lookupUnit |
( |
const hilti::rt::filesystem::path & |
path, |
|
|
std::optional< hilti::rt::filesystem::path > |
ast_extension = {} |
|
) |
| |
Looks up a previously cached unit by its path. It will only return a cached module if its extension matches that of the given path.
- Parameters
-
path | path to look up a unit for |
- Returns
- the cache entry associated with the path if found
◆ options()
const Options& hilti::Context::options |
( |
| ) |
const |
|
inline |
Returns the context's compiler options.
The documentation for this class was generated from the following files:
- /home/docs/checkouts/readthedocs.org/user_builds/spicy-docs/checkouts/v1.3.0/hilti/toolchain/include/compiler/context.h
- /home/docs/checkouts/readthedocs.org/user_builds/spicy-docs/checkouts/v1.3.0/hilti/toolchain/src/compiler/context.cc