summaryrefslogtreecommitdiff
path: root/source/compiler-core/slang-source-loc.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-03-27 13:57:42 -0400
committerGitHub <noreply@github.com>2023-03-27 10:57:42 -0700
commitca1f93a916ce6b984cba402c8d3710988f2b618f (patch)
treef39b638210d38efdc7e2bb746c06b881323d0f53 /source/compiler-core/slang-source-loc.h
parent2179480e28bdd46c71cec269a8f55ba93aa54f53 (diff)
Using SourceMap for location output (#2736)
* #include an absolute path didn't work - because paths were taken to always be relative. * WIP using SourceMap with SourceManager. * Add a test to check obfuscation map is working. --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/compiler-core/slang-source-loc.h')
-rw-r--r--source/compiler-core/slang-source-loc.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/compiler-core/slang-source-loc.h b/source/compiler-core/slang-source-loc.h
index 15c7c0a53..4103c9d6d 100644
--- a/source/compiler-core/slang-source-loc.h
+++ b/source/compiler-core/slang-source-loc.h
@@ -6,6 +6,8 @@
#include "../core/slang-memory-arena.h"
#include "../core/slang-string-slice-pool.h"
+#include "slang-source-map.h"
+
#include "../../slang-com-ptr.h"
#include "../../slang.h"
@@ -245,6 +247,12 @@ public:
/// Get the source manager this was created on
SourceManager* getSourceManager() const { return m_sourceManager; }
+ /// If set this "file" only exists as a way to obfuscate locations
+ /// The mapping between the two is specified in the specified source map
+ SourceMap* getObfuscatedSourceMap() const { return m_obfuscatedSourceMap; }
+ /// Set the obfuscated source map
+ void setObfuscatedSourceMap(SourceMap* sourceMap) { m_obfuscatedSourceMap = sourceMap; }
+
/// Ctor
SourceFile(SourceManager* sourceManager, const PathInfo& pathInfo, size_t contentSize);
/// Dtor
@@ -263,6 +271,10 @@ public:
// we will cache the starting offset of each line break in
// the input file:
List<uint32_t> m_lineBreakOffsets;
+
+ // If set then this file isn't a regular source file, but provides obfuscation.
+ // The mapping of that obfuscation can be found via the obfuscated source map
+ RefPtr<SourceMap> m_obfuscatedSourceMap;
};
enum class SourceLocType