diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-01 03:59:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-01 03:59:34 +0000 |
commit | f1423639d4d7c3b6443c29c5d81de18bbd04c5da (patch) | |
tree | c13b32cb6e066906f7b88d83e7bfe6f3f2ada3cc /include/llvm | |
parent | 8ffa1ff5cb3934feffa90e656f2ccc3b3795e411 (diff) | |
download | external_llvm-f1423639d4d7c3b6443c29c5d81de18bbd04c5da.zip external_llvm-f1423639d4d7c3b6443c29c5d81de18bbd04c5da.tar.gz external_llvm-f1423639d4d7c3b6443c29c5d81de18bbd04c5da.tar.bz2 |
rewrite SourceFile to be in terms of MemoryBuffer, not MappedFile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Debugger/SourceFile.h | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/include/llvm/Debugger/SourceFile.h b/include/llvm/Debugger/SourceFile.h index eeff469..66783ce 100644 --- a/include/llvm/Debugger/SourceFile.h +++ b/include/llvm/Debugger/SourceFile.h @@ -17,11 +17,12 @@ #define LLVM_DEBUGGER_SOURCEFILE_H #include "llvm/System/Path.h" -#include "llvm/System/MappedFile.h" +#include "llvm/ADT/OwningPtr.h" #include <vector> namespace llvm { class GlobalVariable; + class MemoryBuffer; class SourceFile { /// Filename - This is the full path of the file that is loaded. @@ -35,7 +36,7 @@ namespace llvm { const GlobalVariable *Descriptor; /// This is the memory mapping for the file so we can gain access to it. - sys::MappedFile File; + OwningPtr<MemoryBuffer> File; /// LineOffset - This vector contains a mapping from source line numbers to /// their offsets in the file. This data is computed lazily, the first time @@ -49,16 +50,9 @@ namespace llvm { /// NOT throw an exception if the file is not found, if there is an error /// reading it, or if the user cancels the operation. Instead, it will just /// be an empty source file. - SourceFile(const std::string &fn, const GlobalVariable *Desc) - : Filename(fn), Descriptor(Desc), File() { - std::string ErrMsg; - if (File.open(Filename, &ErrMsg)) - throw ErrMsg; - readFile(); - } - ~SourceFile() { - File.unmap(); - } + SourceFile(const std::string &fn, const GlobalVariable *Desc); + + ~SourceFile(); /// getDescriptor - Return the debugging decriptor for this source file. /// @@ -84,10 +78,6 @@ namespace llvm { } private: - /// readFile - Load Filename into memory - /// - void readFile(); - /// calculateLineOffsets - Compute the LineOffset vector for the current /// file. void calculateLineOffsets() const; |