summaryrefslogtreecommitdiffstats
path: root/source/slang/emit.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-10-16 18:49:11 -0400
committerGitHub <noreply@github.com>2018-10-16 18:49:11 -0400
commit3e74d39f24fdfaa547ce900be177863e2bfe2dea (patch)
tree9a5143e6de4caa27b23fc870003011e96129905f /source/slang/emit.cpp
parent204fb3c75b520a2cbb1c25f995a8c424ec2753f3 (diff)
Feature/include refactor (#675)
* Refactor of path handling. * Added PathInfo * Changed ISlangFileSystem - such that has separate concepts of reading a file, getting a relative path and getting a canonical path * Added support for getting a canonical path for windows/linux * Made maps/testing around canonicalPaths * User output remains around 'foundPath' - which is the same as before * Small improvements around PathInfo * Added a type and make constructors to make clear the different 'path' uses * Fixed bug in findViewRecursively * Checking and reporting for ignored #pragma once. * Removed SLANG_PATH_TYPE_NONE as doesn't serve any useful purpose. * Improve comments in slang.h aroung ISlangFileSystem * Remove the need for <windows.h> in slang-io.cpp * Ran premake5. * Improvements and fixes around PathInfo. * Fix typo on linix GetCanonical * Make the ISlangFileSystem the same as before, and ISlangFileSystem contain the new methods. Internally it always uses the ISlangFileSystemExt, and will wrap a ISlangFileSystem with WrapFileSystem, if it is determined (via queryInterface) that it doesn't implement the full interface.
Diffstat (limited to 'source/slang/emit.cpp')
-rw-r--r--source/slang/emit.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index c306186fb..4961518f1 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -541,7 +541,7 @@ struct EmitVisitor
emitRawText(buffer);
// Only emit the path part of a `#line` directive if needed
- if(sourceLocation.path != context->shared->loc.path)
+ if(sourceLocation.pathInfo.foundPath != context->shared->loc.pathInfo.foundPath)
{
emitRawText(" ");
@@ -578,7 +578,7 @@ struct EmitVisitor
if(shouldUseGLSLStyleLineDirective)
{
- auto path = sourceLocation.path;
+ auto path = sourceLocation.pathInfo.foundPath;
// GLSL doesn't support the traditional form of a `#line` directive without
// an extension. Rather than depend on that extension we will output
@@ -609,7 +609,8 @@ struct EmitVisitor
// in a module that tracks source files.
emitRawText("\"");
- for(auto c : sourceLocation.path)
+ const auto& path = sourceLocation.pathInfo.foundPath;
+ for(auto c : path)
{
char charBuffer[] = { c, 0 };
switch(c)
@@ -673,7 +674,7 @@ struct EmitVisitor
// a differnet file or line, *or* if the source location is
// somehow later on the line than what we want to emit,
// then we need to emit a new `#line` directive.
- if(sourceLocation.path != context->shared->loc.path
+ if(sourceLocation.pathInfo.foundPath != context->shared->loc.pathInfo.foundPath
|| sourceLocation.line != context->shared->loc.line
|| sourceLocation.column < context->shared->loc.column)
{
@@ -682,7 +683,7 @@ struct EmitVisitor
// to get us caught up.
enum { kSmallLineCount = 3 };
auto lineDiff = sourceLocation.line - context->shared->loc.line;
- if(sourceLocation.path == context->shared->loc.path
+ if(sourceLocation.pathInfo.foundPath == context->shared->loc.pathInfo.foundPath
&& sourceLocation.line > context->shared->loc.line
&& lineDiff <= kSmallLineCount)
{