diff options
| author | Yong He <yongh@outlook.com> | 2018-01-03 12:46:23 -0800 |
|---|---|---|
| committer | Yong He <yongh@outlook.com> | 2018-01-03 12:46:23 -0800 |
| commit | 9f89c3b2de80c49222c4a6b48e845894c4256a5d (patch) | |
| tree | f35c1aa361e01dc300fc5eafcff0f866f93edc01 /source/slang/compiler.h | |
| parent | f52b93e15d68054a06db84ff86d077d9ce0af941 (diff) | |
Add API for querying TypeLayout from a Type
Added two API functions:
1. `spReflection_FindTypeByName`, which returns a DeclRefType to the struct type with the given name. The function finds from all loaded modules in a `CompileRequest` for a decl with the given name, construct a `Type` object and cache it in `CompileRequest::types` dictionary. The subsequent calls to `spReflection_FindTypeByName` with the same name will simply returned the cached Type objects.
2. `spReflection_GetTypeLayout`, which returns a `TypeLayout` for a given `Type`. This function creates and caches the `TypeLayout` in the `TargetRequest` object that is used to create the `ProgramLayout`.
Diffstat (limited to 'source/slang/compiler.h')
| -rw-r--r-- | source/slang/compiler.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/slang/compiler.h b/source/slang/compiler.h index 0e85a1088..2302c77c0 100644 --- a/source/slang/compiler.h +++ b/source/slang/compiler.h @@ -16,6 +16,7 @@ namespace Slang class CompileRequest; class ProgramLayout; class PtrType; + class TypeLayout; enum class CompilerMode { @@ -197,6 +198,9 @@ namespace Slang // in the parent compile request (indexing matches // the order they are given in the compile request) List<CompileResult> entryPointResults; + + // TypeLayouts created on the fly by reflection API + Dictionary<Type*, RefPtr<TypeLayout>> typeLayouts; }; // A directory to be searched when looking for files (e.g., `#include`) @@ -255,6 +259,9 @@ namespace Slang // assocaited with a translation unit). List<RefPtr<EntryPointRequest> > entryPoints; + // Types constructed by reflection API + Dictionary<String, RefPtr<Type>> types; + // The code generation profile we've been asked to use. Profile profile; |
