[Lldb-commits] [lldb] [lldb] Add Checksum to FileSpec (PR #71457)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 8 16:23:10 PST 2023


================
@@ -420,13 +428,17 @@ class FileSpec {
   ///   The lifetime of the StringRefs is tied to the lifetime of the FileSpec.
   std::vector<llvm::StringRef> GetComponents() const;
 
+  /// Return the checksum for this FileSpec or all zeros if there is none.
+  const Checksum &GetChecksum() const { return m_checksum; };
+
 protected:
   // Convenience method for setting the file without changing the style.
   void SetFile(llvm::StringRef path);
 
   /// Called anytime m_directory or m_filename is changed to clear any cached
   /// state in this object.
   void PathWasModified() {
+    m_checksum = Checksum();
----------------
JDevlieghere wrote:

Given that the FileSpec is a system independent path description (i.e. the file doesn't need to exist on the host) there's no way to recompute it automatically, although the user can specify a new checksum if the path changes.  

https://github.com/llvm/llvm-project/pull/71457


More information about the lldb-commits mailing list