slang::parsing::PreprocessorOptions struct

Contains various options that can control preprocessing behavior.

Public variables

uint32_t maxIncludeDepth
The maximum depth of the include stack; further attempts to include a file will result in an error.
LanguageVersion languageVersion
The version of the SystemVerilog language to use.
std::string predefineSource
The name to associate with errors produced by macros specified via the predefines option.
std::vector<std::string> predefines
A set of macros to predefine, of the form <macro>=<value> or just <macro> to predefine to a value of 1.
std::vector<std::string> undefines
A set of macro names to undefine at the start of file preprocessing.
std::vector<std::filesystem::path> additionalIncludePaths
Additional include paths to use when preprocessing.
flat_hash_set<std::string_view> ignoreDirectives
A set of preprocessor directives to be ignored.
std::vector<std::pair<std::string, KeywordVersion>> keywordMapping
A list of mappings from file patterns to language keyword versions.
function_ref<void(BufferID, bool isBack, bool isSkip)> bufferChangeCB
Optional callback invoked whenever the preprocessor pushes or pops a source file (including include files and skipped headers).

Variable documentation

function_ref<void(BufferID, bool isBack, bool isSkip)> slang::parsing::PreprocessorOptions::bufferChangeCB

Optional callback invoked whenever the preprocessor pushes or pops a source file (including include files and skipped headers).

The arguments are the BufferID of the affected file, whether we are returning to a file (isBack), and whether the file is being skipped as an already-included header (isSkip).