summaryrefslogtreecommitdiff
path: root/source/slang/source-loc.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/source-loc.h')
-rw-r--r--source/slang/source-loc.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/slang/source-loc.h b/source/slang/source-loc.h
index aba9b7bd9..6949d659a 100644
--- a/source/slang/source-loc.h
+++ b/source/slang/source-loc.h
@@ -1,4 +1,4 @@
-// source-loc.h
+// source-loc.h
#ifndef SLANG_SOURCE_LOC_H_INCLUDED
#define SLANG_SOURCE_LOC_H_INCLUDED
@@ -303,6 +303,16 @@ struct SourceManager
/// Get the parent manager to this manager. Returns nullptr if there isn't any.
SourceManager* getParent() const { return m_parent; }
+ /// A memory arena to hold allocations that are in scope for the same time as SourceManager
+ MemoryArena* getMemoryArena() { return &m_memoryArena; }
+
+ /// Allocate a string slice
+ UnownedStringSlice allocateStringSlice(const UnownedStringSlice& slice);
+
+ SourceManager() :
+ m_memoryArena(2048)
+ {}
+
protected:
// The first location available to this source manager
@@ -320,6 +330,10 @@ struct SourceManager
List<RefPtr<SourceView> > m_sourceViews;
StringSlicePool m_slicePool;
+ // Memory arena that can be used for holding data to held in scope as long as the Source is
+ // Can be used for storing the decoded contents of Token.Content for exampel
+ MemoryArena m_memoryArena;
+
// Maps canonical paths to source files
Dictionary<String, RefPtr<SourceFile> > m_sourceFiles;
};