summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-preprocessor.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-08-19 15:51:43 -0400
committerGitHub <noreply@github.com>2020-08-19 12:51:43 -0700
commitb5a4161a801a573179b1f552e5c53748d2667b03 (patch)
tree4b63bc7274ac060054ab239da4f75aa7233bbddf /source/slang/slang-preprocessor.cpp
parent2fffbc5ff0727482c6ab7d66f6d852701adb277b (diff)
Remove IncludeHandler. (#1505)
nvAPI -> NVAPI nvAPIPath -> nvapiPath DxcIncludeHandler don't reference count. nv-api-path -> nvapi-path Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-preprocessor.cpp')
-rw-r--r--source/slang/slang-preprocessor.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/source/slang/slang-preprocessor.cpp b/source/slang/slang-preprocessor.cpp
index 1c7f338fb..fceee27f9 100644
--- a/source/slang/slang-preprocessor.cpp
+++ b/source/slang/slang-preprocessor.cpp
@@ -203,9 +203,8 @@ struct Preprocessor
// diagnostics sink to use when writing messages
DiagnosticSink* sink;
- // An external callback interface to use when looking
- // for files in a `#include` directive
- IncludeHandler* includeHandler;
+ // Functionality for looking up files in a `#include` directive
+ IncludeSystem* includeSystem;
// Current input stream (top of the stack of input)
PreprocessorInputStream* inputStream;
@@ -1818,8 +1817,8 @@ static void HandleIncludeDirective(PreprocessorDirectiveContext* context)
PathInfo includedFromPathInfo = context->preprocessor->getSourceManager()->getPathInfo(directiveLoc, SourceLocType::Actual);
- IncludeHandler* includeHandler = context->preprocessor->includeHandler;
- if (!includeHandler)
+ IncludeSystem* includeSystem = context->preprocessor->includeSystem;
+ if (!includeSystem)
{
GetSink(context)->diagnose(pathToken.loc, Diagnostics::includeFailed, path);
GetSink(context)->diagnose(pathToken.loc, Diagnostics::noIncludeHandlerSpecified);
@@ -1828,7 +1827,7 @@ static void HandleIncludeDirective(PreprocessorDirectiveContext* context)
/* Find the path relative to the foundPath */
PathInfo filePathInfo;
- if (SLANG_FAILED(includeHandler->findFile(path, includedFromPathInfo.foundPath, filePathInfo)))
+ if (SLANG_FAILED(includeSystem->findFile(path, includedFromPathInfo.foundPath, filePathInfo)))
{
GetSink(context)->diagnose(pathToken.loc, Diagnostics::includeFailed, path);
return;
@@ -1853,7 +1852,7 @@ static void HandleIncludeDirective(PreprocessorDirectiveContext* context)
}
// Simplify the path
- filePathInfo.foundPath = includeHandler->simplifyPath(filePathInfo.foundPath);
+ filePathInfo.foundPath = includeSystem->simplifyPath(filePathInfo.foundPath);
// Push the new file onto our stack of input streams
// TODO(tfoley): check if we have made our include stack too deep
@@ -2355,7 +2354,7 @@ static void InitializePreprocessor(
DiagnosticSink* sink)
{
preprocessor->sink = sink;
- preprocessor->includeHandler = NULL;
+ preprocessor->includeSystem = NULL;
preprocessor->endOfFileToken.type = TokenType::EndOfFile;
preprocessor->endOfFileToken.flags = TokenFlag::AtStartOfLine;
}
@@ -2451,7 +2450,7 @@ static TokenList ReadAllTokens(
TokenList preprocessSource(
SourceFile* file,
DiagnosticSink* sink,
- IncludeHandler* includeHandler,
+ IncludeSystem* includeSystem,
Dictionary<String, String> defines,
Linkage* linkage,
Module* parentModule)
@@ -2461,7 +2460,7 @@ TokenList preprocessSource(
preprocessor.linkage = linkage;
preprocessor.parentModule = parentModule;
- preprocessor.includeHandler = includeHandler;
+ preprocessor.includeSystem = includeSystem;
for (auto p : defines)
{
DefineMacro(&preprocessor, p.Key, p.Value);