]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/syntax.h
Record location information in all syntax nodes
[libs/gl.git] / source / glsl / syntax.h
index 384bd60f603dc04cef77d41a67f5f190d5414851..f275eab8c4ae454ee369ac10e40d3c0e4499190a 100644 (file)
@@ -8,6 +8,7 @@
 #include <vector>
 #include <msp/core/refptr.h>
 #include "features.h"
+#include "glsl_error.h"
 #include "sourcemap.h"
 
 #pragma push_macro("interface")
@@ -54,9 +55,11 @@ struct NodeVisitor;
 
 struct Node
 {
-protected:
-       Node() { }
-       Node(const Node &) { }
+       int source;
+       unsigned line;
+
+       Node(): source(GENERATED_SOURCE), line(1) { }
+       Node(const Node &n): source(n.source), line(n.line) { }
 private:
        Node &operator=(const Node &);
 public:
@@ -105,11 +108,6 @@ struct FunctionDeclaration;
 
 struct Statement: Node
 {
-       int source;
-       unsigned line;
-
-       Statement();
-
        virtual Statement *clone() const = 0;
 };
 
@@ -420,6 +418,7 @@ struct Stage
        std::map<std::string, FunctionDeclaration *> functions;
        std::map<std::string, unsigned> locations;
        Features required_features;
+       std::vector<Diagnostic> diagnostics;
 
        Stage(Type);