summaryrefslogtreecommitdiff
path: root/include/clang/Basic/SourceManagerInternals.h
diff options
context:
space:
mode:
authorDavid L. Jones <dlj@google.com>2017-11-15 01:40:05 +0000
committerDavid L. Jones <dlj@google.com>2017-11-15 01:40:05 +0000
commitfdfce82b87b73e18577d493e84bdabe2585b95d0 (patch)
treee8d9290e273dba03920bf15a8c7742fcf5ed0b87 /include/clang/Basic/SourceManagerInternals.h
parent41af1698c520ea38edf83e7c91f1e519d34f20c1 (diff)
parenta7540887e8b5cb34ee28c12bef863bad85c65b6f (diff)
downloadclang-google/testing.tar.gz
Creating branches/google/testing and tags/google/testing/2017-11-14 from r317716google/testing
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/testing@318248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceManagerInternals.h')
-rw-r--r--include/clang/Basic/SourceManagerInternals.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/include/clang/Basic/SourceManagerInternals.h b/include/clang/Basic/SourceManagerInternals.h
index 9403dea888..edd910e704 100644
--- a/include/clang/Basic/SourceManagerInternals.h
+++ b/include/clang/Basic/SourceManagerInternals.h
@@ -1,4 +1,4 @@
-//===--- SourceManagerInternals.h - SourceManager Internals -----*- C++ -*-===//
+//===- SourceManagerInternals.h - SourceManager Internals -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -6,10 +6,10 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-///
+//
/// \file
/// \brief Defines implementation details of the clang::SourceManager class.
-///
+//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_BASIC_SOURCEMANAGERINTERNALS_H
@@ -18,7 +18,11 @@
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Allocator.h"
+#include <cassert>
#include <map>
+#include <vector>
namespace clang {
@@ -86,7 +90,8 @@ class LineTableInfo {
/// \brief Map from FileIDs to a list of line entries (sorted by the offset
/// at which they occur in the file).
- std::map<FileID, std::vector<LineEntry> > LineEntries;
+ std::map<FileID, std::vector<LineEntry>> LineEntries;
+
public:
void clear() {
FilenameIDs.clear();
@@ -95,10 +100,12 @@ public:
}
unsigned getLineTableFilenameID(StringRef Str);
+
StringRef getFilename(unsigned ID) const {
assert(ID < FilenamesByID.size() && "Invalid FilenameID");
return FilenamesByID[ID]->getKey();
}
+
unsigned getNumFilenames() const { return FilenamesByID.size(); }
void AddLineNote(FileID FID, unsigned Offset,
@@ -112,7 +119,8 @@ public:
const LineEntry *FindNearestLineEntry(FileID FID, unsigned Offset);
// Low-level access
- typedef std::map<FileID, std::vector<LineEntry> >::iterator iterator;
+ using iterator = std::map<FileID, std::vector<LineEntry>>::iterator;
+
iterator begin() { return LineEntries.begin(); }
iterator end() { return LineEntries.end(); }
@@ -121,6 +129,6 @@ public:
void AddEntry(FileID FID, const std::vector<LineEntry> &Entries);
};
-} // end namespace clang
+} // namespace clang
-#endif
+#endif // LLVM_CLANG_BASIC_SOURCEMANAGERINTERNALS_H