From 8ec5b3e6ef2e7e5c3adaa5accb375676b1c09ff0 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 22 Feb 2024 07:14:55 -0800 Subject: Add API for querying and reusing precompiled binary modules. (#3614) --- source/compiler-core/slang-source-loc.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source/compiler-core/slang-source-loc.cpp') diff --git a/source/compiler-core/slang-source-loc.cpp b/source/compiler-core/slang-source-loc.cpp index fe08f8dfc..872c40f0d 100644 --- a/source/compiler-core/slang-source-loc.cpp +++ b/source/compiler-core/slang-source-loc.cpp @@ -4,7 +4,6 @@ #include "../core/slang-string-util.h" #include "../core/slang-string-escape-util.h" #include "../core/slang-char-encode.h" - #include "slang-artifact-representation-impl.h" #include "slang-artifact-impl.h" #include "slang-artifact-util.h" @@ -602,6 +601,17 @@ SourceFile::~SourceFile() { } +SHA1::Digest SourceFile::getDigest() +{ + if (m_digest == SHA1::Digest()) + { + DigestBuilder builder; + builder.append(getContent()); + m_digest = builder.finalize(); + } + return m_digest; +} + String SourceFile::calcVerbosePath() const { ISlangFileSystemExt* fileSystemExt = getSourceManager()->getFileSystemExt(); -- cgit v1.2.3