llvm.org GIT mirror llvm / 3343be3
For PR351:\ * Modify file reading to use sys::MappedFile \ * Use sys::Path instead of std::string git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18851 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 15 years ago
1 changed file(s) with 9 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
1515 #ifndef LLVM_DEBUGGER_SOURCEFILE_H
1616 #define LLVM_DEBUGGER_SOURCEFILE_H
1717
18 #include
18 #include "llvm/System/Path.h"
19 #include "llvm/System/MappedFile.h"
1920 #include
2021
2122 namespace llvm {
2425 class SourceFile {
2526 /// Filename - This is the full path of the file that is loaded.
2627 ///
27 std::string Filename;
28 sys::Path Filename;
2829
2930 /// Descriptor - The debugging descriptor for this source file. If there
3031 /// are multiple descriptors for the same file, this is just the first one
3233 ///
3334 const GlobalVariable *Descriptor;
3435
35 /// FileStart, FileEnd - These pointers point to the start and end of the
36 /// file data for this file. If there was an error loading the file, these
37 /// pointers will both be null.
38 const char *FileStart, *FileEnd;
36 /// This is the memory mapping for the file so we can gain access to it.
37 sys::MappedFile File;
3938
4039 /// LineOffset - This vector contains a mapping from source line numbers to
4140 /// their offsets in the file. This data is computed lazily, the first time
5049 /// reading it, or if the user cancels the operation. Instead, it will just
5150 /// be an empty source file.
5251 SourceFile(const std::string &fn, const GlobalVariable *Desc)
53 : Filename(fn), Descriptor(Desc), FileStart(0), FileEnd(0) {
52 : Filename(fn), Descriptor(Desc), File(Filename) {
5453 readFile();
5554 }
5655 ~SourceFile() {
57 delete[] FileStart;
56 File.unmap();
5857 }
5958
6059 /// getDescriptor - Return the debugging decriptor for this source file.
6362
6463 /// getFilename - Return the fully resolved path that this file was loaded
6564 /// from.
66 const std::string &getFilename() const { return Filename; }
65 const std::string &getFilename() const { return Filename.toString(); }
6766
6867 /// getSourceLine - Given a line number, return the start and end of the
6968 /// line in the file. If the line number is invalid, or if the file could
8180 }
8281
8382 private:
84 /// readFile - Load Filename into FileStart and FileEnd.
83 /// readFile - Load Filename into memory
8584 ///
8685 void readFile();
8786