[Lldb-commits] [lldb] 1b5f72c - [lldb] Hoist SupportFile out of FileSpecList (NFC)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Jan 16 14:20:30 PST 2024
Author: Jonas Devlieghere
Date: 2024-01-16T14:20:22-08:00
New Revision: 1b5f72c5ece4442ca29ced45f8bcb25ed0d57790
URL: https://github.com/llvm/llvm-project/commit/1b5f72c5ece4442ca29ced45f8bcb25ed0d57790
DIFF: https://github.com/llvm/llvm-project/commit/1b5f72c5ece4442ca29ced45f8bcb25ed0d57790.diff
LOG: [lldb] Hoist SupportFile out of FileSpecList (NFC)
This hoists SupportFile out of FileSpecList. SupportFileList is still
implemented there as it's very similar to FileSpecList.
Added:
lldb/include/lldb/Utility/SupportFile.h
Modified:
lldb/include/lldb/Utility/FileSpecList.h
Removed:
################################################################################
diff --git a/lldb/include/lldb/Utility/FileSpecList.h b/lldb/include/lldb/Utility/FileSpecList.h
index c1107ad1135dd2..6ddb9d1aa646a2 100644
--- a/lldb/include/lldb/Utility/FileSpecList.h
+++ b/lldb/include/lldb/Utility/FileSpecList.h
@@ -9,8 +9,8 @@
#ifndef LLDB_CORE_FILESPECLIST_H
#define LLDB_CORE_FILESPECLIST_H
-#include "lldb/Utility/Checksum.h"
#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/SupportFile.h"
#include <cstddef>
#include <vector>
@@ -18,33 +18,6 @@
namespace lldb_private {
class Stream;
-/// Wraps either a FileSpec that represents a local file or a source
-/// file whose contents is known (for example because it can be
-/// reconstructed from debug info), but that hasn't been written to a
-/// file yet.
-class SupportFile {
-protected:
- FileSpec m_file_spec;
- Checksum m_checksum;
-
-public:
- SupportFile(const FileSpec &spec) : m_file_spec(spec), m_checksum() {}
- SupportFile(const FileSpec &spec, const Checksum &checksum)
- : m_file_spec(spec), m_checksum(checksum) {}
- SupportFile(const SupportFile &other) = delete;
- SupportFile(SupportFile &&other) = default;
- virtual ~SupportFile() = default;
- bool operator==(const SupportFile &other) {
- return m_file_spec == other.m_file_spec && m_checksum == other.m_checksum;
- }
- /// Return the file name only. Useful for resolving breakpoints by file name.
- const FileSpec &GetSpecOnly() const { return m_file_spec; };
- /// Return the checksum or all zeros if there is none.
- const Checksum &GetChecksum() const { return m_checksum; };
- /// Materialize the file to disk and return the path to that temporary file.
- virtual const FileSpec &Materialize() { return m_file_spec; }
-};
-
/// A list of support files for a CompileUnit.
class SupportFileList {
public:
diff --git a/lldb/include/lldb/Utility/SupportFile.h b/lldb/include/lldb/Utility/SupportFile.h
new file mode 100644
index 00000000000000..5156b3e72b32d4
--- /dev/null
+++ b/lldb/include/lldb/Utility/SupportFile.h
@@ -0,0 +1,52 @@
+//===-- SupportFile.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_SUPPORTFILE_H
+#define LLDB_UTILITY_SUPPORTFILE_H
+
+#include "lldb/Utility/Checksum.h"
+#include "lldb/Utility/FileSpec.h"
+
+namespace lldb_private {
+
+/// Wraps either a FileSpec that represents a local file or a source
+/// file whose contents is known (for example because it can be
+/// reconstructed from debug info), but that hasn't been written to a
+/// file yet. This also stores an optional checksum of the on-disk content.
+class SupportFile {
+public:
+ SupportFile(const FileSpec &spec) : m_file_spec(spec), m_checksum() {}
+ SupportFile(const FileSpec &spec, const Checksum &checksum)
+ : m_file_spec(spec), m_checksum(checksum) {}
+
+ SupportFile(const SupportFile &other) = delete;
+ SupportFile(SupportFile &&other) = default;
+
+ virtual ~SupportFile() = default;
+
+ bool operator==(const SupportFile &other) {
+ return m_file_spec == other.m_file_spec && m_checksum == other.m_checksum;
+ }
+
+ /// Return the file name only. Useful for resolving breakpoints by file name.
+ const FileSpec &GetSpecOnly() const { return m_file_spec; };
+
+ /// Return the checksum or all zeros if there is none.
+ const Checksum &GetChecksum() const { return m_checksum; };
+
+ /// Materialize the file to disk and return the path to that temporary file.
+ virtual const FileSpec &Materialize() { return m_file_spec; }
+
+protected:
+ FileSpec m_file_spec;
+ Checksum m_checksum;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_SUPPORTFILE_H
More information about the lldb-commits
mailing list