diff options
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/SourceManager.h | 18 | ||||
-rw-r--r-- | include/clang/Basic/SourceManagerInternals.h | 12 |
2 files changed, 23 insertions, 7 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index dcf344e412..217640eaa5 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -589,7 +589,13 @@ public: void AddLineNote(SourceLocation Loc, unsigned LineNo, int FilenameID, bool IsFileEntry, bool IsFileExit, bool IsSystemHeader, bool IsExternCHeader); - + + /// \brief Determine if the source manager has a line table. + bool hasLineTable() const { return LineTable != 0; } + + /// \brief Retrieve the stored line table. + LineTableInfo &getLineTable(); + //===--------------------------------------------------------------------===// // Other miscellaneous methods. //===--------------------------------------------------------------------===// @@ -624,6 +630,11 @@ public: unsigned sloc_entry_size() const { return SLocEntryTable.size(); } + const SrcMgr::SLocEntry &getSLocEntry(FileID FID) const { + assert(FID.ID < SLocEntryTable.size() && "Invalid id"); + return SLocEntryTable[FID.ID]; + } + private: friend class SrcMgr::ContentCache; // Used for deserialization. @@ -654,11 +665,6 @@ private: /// memory buffer. const SrcMgr::ContentCache* createMemBufferContentCache(const llvm::MemoryBuffer *Buf); - - const SrcMgr::SLocEntry &getSLocEntry(FileID FID) const { - assert(FID.ID < SLocEntryTable.size() && "Invalid id"); - return SLocEntryTable[FID.ID]; - } FileID getFileIDSlow(unsigned SLocOffset) const; diff --git a/include/clang/Basic/SourceManagerInternals.h b/include/clang/Basic/SourceManagerInternals.h index 2f90f64b0f..0bcb68e460 100644 --- a/include/clang/Basic/SourceManagerInternals.h +++ b/include/clang/Basic/SourceManagerInternals.h @@ -102,7 +102,8 @@ public: assert(ID < FilenamesByID.size() && "Invalid FilenameID"); return FilenamesByID[ID]->getKeyData(); } - + unsigned getNumFilenames() const { return FilenamesByID.size(); } + void AddLineNote(unsigned FID, unsigned Offset, unsigned LineNo, int FilenameID); void AddLineNote(unsigned FID, unsigned Offset, @@ -113,6 +114,15 @@ public: /// FindNearestLineEntry - Find the line entry nearest to FID that is before /// it. If there is no line entry before Offset in FID, return null. const LineEntry *FindNearestLineEntry(unsigned FID, unsigned Offset); + + // Low-level access + typedef std::map<unsigned, std::vector<LineEntry> >::iterator iterator; + iterator begin() { return LineEntries.begin(); } + iterator end() { return LineEntries.end(); } + + /// \brief Add a new line entry that has already been encoded into + /// the internal representation of the line table. + void AddEntry(unsigned FID, const std::vector<LineEntry> &Entries); }; } // end namespace clang |