Fix #1333: Protect against -g for non-generating code.
authorJohn Kessenich <cepheus@frii.com>
Fri, 6 Apr 2018 01:00:01 +0000 (19:00 -0600)
committerJohn Kessenich <cepheus@frii.com>
Fri, 6 Apr 2018 01:00:01 +0000 (19:00 -0600)
StandAlone/StandAlone.cpp
glslang/MachineIndependent/localintermediate.h

index bb38e1c..044662f 100644 (file)
@@ -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);
index a622639..17e0765 100644 (file)
@@ -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; }