Improve ResourceLimits interface to be more forward compatible
[platform/upstream/glslang.git] / StandAlone / DirStackFileIncluder.h
index 8d6543a..5a33c78 100644 (file)
@@ -40,6 +40,7 @@
 #include <string>
 #include <fstream>
 #include <algorithm>
+#include <set>
 
 #include "./../glslang/Public/ShaderLang.h"
 
@@ -54,7 +55,7 @@ public:
                                         const char* includerName,
                                         size_t inclusionDepth) override
     {
-        return readLocalPath(headerName, includerName, inclusionDepth);
+        return readLocalPath(headerName, includerName, (int)inclusionDepth);
     }
 
     virtual IncludeResult* includeSystem(const char* headerName,
@@ -73,7 +74,7 @@ public:
     virtual void pushExternalLocalDirectory(const std::string& dir)
     {
         directoryStack.push_back(dir);
-        externalLocalDirectoryCount = directoryStack.size();
+        externalLocalDirectoryCount = (int)directoryStack.size();
     }
 
     virtual void releaseInclude(IncludeResult* result) override
@@ -84,12 +85,18 @@ public:
         }
     }
 
+    virtual std::set<std::string> getIncludedFiles()
+    {
+        return includedFiles;
+    }
+
     virtual ~DirStackFileIncluder() override { }
 
 protected:
     typedef char tUserDataElement;
     std::vector<std::string> directoryStack;
     int externalLocalDirectoryCount;
+    std::set<std::string> includedFiles;
 
     // Search for a valid "local" path based on combining the stack of include
     // directories and the nominal name of the header.
@@ -108,6 +115,7 @@ protected:
             std::ifstream file(path, std::ios_base::binary | std::ios_base::ate);
             if (file) {
                 directoryStack.push_back(getDirectory(path));
+                includedFiles.insert(path);
                 return newIncludeResult(path, file, (int)file.tellg());
             }
         }