summaryrefslogtreecommitdiff
path: root/tools/slang-generate/main.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-12-04 13:03:29 -0500
committerGitHub <noreply@github.com>2020-12-04 10:03:29 -0800
commit47ed0f68602a8ed0c425d2a4666969ad0db04ca6 (patch)
treec104f182dbf1a2b9e12e8d383215749e11ab35dc /tools/slang-generate/main.cpp
parent277780ab7770453ed12e82df10d2a9d79ebf47dd (diff)
Projects in 'build' and Slang API separation (#1624)
* #include an absolute path didn't work - because paths were taken to always be relative. * Move reflection to reflection-api. * Slight reorg to pull out potentially Slang internal functions from the reflection API impls. * Remove visual studio projects * Fix for slang-binaries copy. * Add the visual studio projects in build/visual-studio * Remove miniz project. * Differentiate the linePath from the filePath. * Improve comment in premake5.lua + to kick of CI. * Kick CI.
Diffstat (limited to 'tools/slang-generate/main.cpp')
-rw-r--r--tools/slang-generate/main.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/slang-generate/main.cpp b/tools/slang-generate/main.cpp
index 796bbd59d..8e4824065 100644
--- a/tools/slang-generate/main.cpp
+++ b/tools/slang-generate/main.cpp
@@ -47,6 +47,8 @@ struct Node
struct SourceFile : public RefObject
{
String inputPath;
+ String linePath; ///< The path to this file for #line output
+
StringSpan text;
Node* node = nullptr;
SourceFile() = default;
@@ -658,7 +660,7 @@ void emitTemplateNodes(
if (lineIndex >= 0)
{
StringBuilder buf;
- buf << "SLANG_RAW(\"#line " << (lineIndex + 1) << " \\\"" << sourceFile->inputPath << "\\\"\")\n";
+ buf << "SLANG_RAW(\"#line " << (lineIndex + 1) << " \\\"" << sourceFile->linePath << "\\\"\")\n";
emit(stream, buf.getUnownedSlice());
}
@@ -806,7 +808,13 @@ SourceFile* parseSourceFile(const String& path)
StringSpan span = StringSpan(input, inputEnd);
SourceFile* sourceFile = new SourceFile();
+
sourceFile->inputPath = path;
+
+ // We use the fileName as the line path, as the path as passed to the command could contain a complicated
+ // depending on the project location.
+ sourceFile->linePath = Path::getFileName(path);
+
sourceFile->text = span;
Node* node = parseSourceFile(sourceFile);