]> granicus.if.org Git - clang/blobdiff - include/clang/Basic/SourceManagerInternals.h
Header guard canonicalization, clang part.
[clang] / include / clang / Basic / SourceManagerInternals.h
index 258989cb7787e0213adea6db57f7c40756be4723..f31d604244d05d0926fbb7ec7e2b2701826c7c18 100644 (file)
@@ -6,15 +6,16 @@
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-//
-//  This file defines the implementation details of the SourceManager
-//  class.
-//
+///
+/// \file
+/// \brief Defines implementation details of the clang::SourceManager class.
+///
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_SOURCEMANAGER_INTERNALS_H
-#define LLVM_CLANG_SOURCEMANAGER_INTERNALS_H
+#ifndef LLVM_CLANG_BASIC_SOURCEMANAGERINTERNALS_H
+#define LLVM_CLANG_BASIC_SOURCEMANAGERINTERNALS_H
 
+#include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "llvm/ADT/StringMap.h"
 #include <map>
@@ -26,22 +27,23 @@ namespace clang {
 //===----------------------------------------------------------------------===//
 
 struct LineEntry {
-  /// FileOffset - The offset in this file that the line entry occurs at.
+  /// \brief The offset in this file that the line entry occurs at.
   unsigned FileOffset;
 
-  /// LineNo - The presumed line number of this line entry: #line 4.
+  /// \brief The presumed line number of this line entry: \#line 4.
   unsigned LineNo;
 
-  /// FilenameID - The ID of the filename identified by this line entry:
-  /// #line 4 "foo.c".  This is -1 if not specified.
+  /// \brief The ID of the filename identified by this line entry:
+  /// \#line 4 "foo.c".  This is -1 if not specified.
   int FilenameID;
 
-  /// Flags - Set the 0 if no flags, 1 if a system header,
+  /// \brief Set the 0 if no flags, 1 if a system header,
   SrcMgr::CharacteristicKind FileKind;
 
-  /// IncludeOffset - This is the offset of the virtual include stack location,
-  /// which is manipulated by GNU linemarker directives.  If this is 0 then
-  /// there is no virtual #includer.
+  /// \brief The offset of the virtual include stack location,
+  /// which is manipulated by GNU linemarker directives.
+  ///
+  /// If this is 0 then there is no virtual \#includer.
   unsigned IncludeOffset;
 
   static LineEntry get(unsigned Offs, unsigned Line, int Filename,
@@ -71,20 +73,20 @@ inline bool operator<(unsigned Offset, const LineEntry &E) {
   return Offset < E.FileOffset;
 }
 
-/// LineTableInfo - This class is used to hold and unique data used to
-/// represent #line information.
+/// \brief Used to hold and unique data used to represent \#line information.
 class LineTableInfo {
-  /// FilenameIDs - This map is used to assign unique IDs to filenames in
-  /// #line directives.  This allows us to unique the filenames that
+  /// \brief Map used to assign unique IDs to filenames in \#line directives. 
+  ///
+  /// This allows us to unique the filenames that
   /// frequently reoccur and reference them with indices.  FilenameIDs holds
   /// the mapping from string -> ID, and FilenamesByID holds the mapping of ID
   /// to string.
   llvm::StringMap<unsigned, llvm::BumpPtrAllocator> FilenameIDs;
   std::vector<llvm::StringMapEntry<unsigned>*> FilenamesByID;
 
-  /// LineEntries - This is a map from FileIDs to a list of line entries (sorted
-  /// by the offset they occur in the file.
-  std::map<unsigned, std::vector<LineEntry> > LineEntries;
+  /// \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;
 public:
   LineTableInfo() {
   }
@@ -97,32 +99,33 @@ public:
 
   ~LineTableInfo() {}
 
-  unsigned getLineTableFilenameID(const char *Ptr, unsigned Len);
+  unsigned getLineTableFilenameID(StringRef Str);
   const char *getFilename(unsigned ID) const {
     assert(ID < FilenamesByID.size() && "Invalid FilenameID");
     return FilenamesByID[ID]->getKeyData();
   }
   unsigned getNumFilenames() const { return FilenamesByID.size(); }
 
-  void AddLineNote(unsigned FID, unsigned Offset,
+  void AddLineNote(FileID FID, unsigned Offset,
                    unsigned LineNo, int FilenameID);
-  void AddLineNote(unsigned FID, unsigned Offset,
+  void AddLineNote(FileID FID, unsigned Offset,
                    unsigned LineNo, int FilenameID,
                    unsigned EntryExit, SrcMgr::CharacteristicKind FileKind);
 
 
-  /// 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);
+  /// \brief Find the line entry nearest to FID that is before it.
+  ///
+  /// If there is no line entry before \p Offset in \p FID, returns null.
+  const LineEntry *FindNearestLineEntry(FileID FID, unsigned Offset);
 
   // Low-level access
-  typedef std::map<unsigned, std::vector<LineEntry> >::iterator iterator;
+  typedef std::map<FileID, 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);
+  void AddEntry(FileID FID, const std::vector<LineEntry> &Entries);
 };
 
 } // end namespace clang