From 7f0bcfd8d844c0d76c2c7e7d8daed6167bc053ea Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Thu, 5 Apr 2018 19:00:01 -0600 Subject: [PATCH] Fix #1333: Protect against -g for non-generating code. --- StandAlone/StandAlone.cpp | 3 +++ glslang/MachineIndependent/localintermediate.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index bb38e1cf5..044662fe0 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -729,6 +729,9 @@ void SetMessageOptions(EShMessages& messages) // void CompileShaders(glslang::TWorklist& worklist) { + if (Options & EOptionDebug) + Error("cannot generate debug information unless linking to generate code"); + glslang::TWorkItem* workItem; if (Options & EOptionStdin) { worklist.remove(workItem); diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index a6226392f..17e076519 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -619,7 +619,7 @@ public: return semanticNameSet.insert(name).first->c_str(); } - void setSourceFile(const char* file) { sourceFile = file; } + void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; } const std::string& getSourceFile() const { return sourceFile; } void addSourceText(const char* text) { sourceText = sourceText + text; } const std::string& getSourceText() const { return sourceText; }