diff options
Diffstat (limited to 'source/slang/preprocessor.cpp')
| -rw-r--r-- | source/slang/preprocessor.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/slang/preprocessor.cpp b/source/slang/preprocessor.cpp index 4ccb5d50e..91043bcf9 100644 --- a/source/slang/preprocessor.cpp +++ b/source/slang/preprocessor.cpp @@ -842,7 +842,7 @@ top: PathInfo pathInfo = PathInfo::makeTokenPaste(); SourceFile* sourceFile = sourceManager->createSourceFileWithString(pathInfo, sb.ProduceString()); - SourceView* sourceView = sourceManager->createSourceView(sourceFile); + SourceView* sourceView = sourceManager->createSourceView(sourceFile, nullptr); Lexer lexer; lexer.initialize(sourceView, GetSink(preprocessor), getNamePool(preprocessor), sourceManager->getMemoryArena()); @@ -1627,6 +1627,9 @@ static void HandleIncludeDirective(PreprocessorDirectiveContext* context) return; } + // Simplify the path + filePathInfo.foundPath = includeHandler->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 auto sourceManager = context->preprocessor->getCompileRequest()->getSourceManager(); @@ -1643,12 +1646,13 @@ static void HandleIncludeDirective(PreprocessorDirectiveContext* context) return; } + sourceFile = sourceManager->createSourceFileWithBlob(filePathInfo, foundSourceBlob); sourceManager->addSourceFile(filePathInfo.uniqueIdentity, sourceFile); } // This is a new parse (even if it's a pre-existing source file), so create a new SourceUnit - SourceView* sourceView = sourceManager->createSourceView(sourceFile); + SourceView* sourceView = sourceManager->createSourceView(sourceFile, &filePathInfo); PreprocessorInputStream* inputStream = CreateInputStreamForSource(context->preprocessor, sourceView); inputStream->parent = context->preprocessor->inputStream; @@ -2259,8 +2263,8 @@ static void DefineMacro( SourceFile* keyFile = sourceManager->createSourceFileWithString(pathInfo, key); SourceFile* valueFile = sourceManager->createSourceFileWithString(pathInfo, value); - SourceView* keyView = sourceManager->createSourceView(keyFile); - SourceView* valueView = sourceManager->createSourceView(valueFile); + SourceView* keyView = sourceManager->createSourceView(keyFile, nullptr); + SourceView* valueView = sourceManager->createSourceView(valueFile, nullptr); // Use existing `Lexer` to generate a token stream. Lexer lexer; @@ -2319,7 +2323,7 @@ TokenList preprocessSource( SourceManager* sourceManager = translationUnit->compileRequest->getSourceManager(); - SourceView* sourceView = sourceManager->createSourceView(file); + SourceView* sourceView = sourceManager->createSourceView(file, nullptr); // create an initial input stream based on the provided buffer preprocessor.inputStream = CreateInputStreamForSource(&preprocessor, sourceView); |
