[cfe-commits] r139333 - /cfe/trunk/include/clang/Basic/SourceManager.h

Eric Christopher echristo at apple.com
Thu Sep 8 16:28:19 PDT 2011


Author: echristo
Date: Thu Sep  8 18:28:19 2011
New Revision: 139333

URL: http://llvm.org/viewvc/llvm-project?rev=139333&view=rev
Log:
Rearrange comment slightly for Bill.

Modified:
    cfe/trunk/include/clang/Basic/SourceManager.h

Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=139333&r1=139332&r2=139333&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Thu Sep  8 18:28:19 2011
@@ -37,7 +37,7 @@
 class LangOptions;
 class ASTWriter;
 class ASTReader;
-  
+
 /// There are three different types of locations in a file: a spelling
 /// location, an expansion location, and a presumed location.
 ///
@@ -45,8 +45,8 @@
 /// #define min(x, y) x < y ? x : y
 ///
 /// and then later on a use of min:
-/// return min(a, b);
 /// #line 17
+/// return min(a, b);
 ///
 /// The expansion location is the line in the source code where the macro
 /// was expanded (the return statement), the spelling location is the
@@ -77,7 +77,7 @@
       /// \brief Whether the buffer should not be freed on destruction.
       DoNotFreeFlag = 0x02
     };
-    
+
     /// Buffer - The actual buffer containing the characters from the input
     /// file.  This is owned by the ContentCache object.
     /// The bits indicate indicates whether the buffer is invalid.
@@ -113,7 +113,7 @@
     ///
     /// \param Diag Object through which diagnostics will be emitted if the
     /// buffer cannot be retrieved.
-    /// 
+    ///
     /// \param Loc If specified, is the location that invalid file diagnostics
     ///     will be emitted at.
     ///
@@ -133,7 +133,7 @@
     /// this ContentCache. This can be 0 if the MemBuffer was not actually
     /// expanded.
     unsigned getSizeBytesMapped() const;
-    
+
     /// Returns the kind of memory used to back the memory buffer for
     /// this content cache.  This is used for performance analysis.
     llvm::MemoryBuffer::BufferKind getMemoryBufferKind() const;
@@ -143,7 +143,7 @@
       Buffer.setPointer(B);
       Buffer.setInt(false);
     }
-    
+
     /// \brief Get the underlying buffer, returning NULL if the buffer is not
     /// yet available.
     const llvm::MemoryBuffer *getRawBuffer() const {
@@ -158,12 +158,12 @@
     bool isBufferInvalid() const {
       return Buffer.getInt() & InvalidFlag;
     }
-    
+
     /// \brief Determine whether the buffer should be freed.
     bool shouldFreeBuffer() const {
       return (Buffer.getInt() & DoNotFreeFlag) == 0;
     }
-    
+
     ContentCache(const FileEntry *Ent = 0)
       : Buffer(0, false), OrigEntry(Ent), ContentsEntry(Ent),
         SourceLineCache(0), NumLines(0), MacroArgsCache(0) {}
@@ -177,7 +177,7 @@
     /// The copy ctor does not allow copies where source object has either
     ///  a non-NULL Buffer or SourceLineCache.  Ownership of allocated memory
     ///  is not transferred, so this is a logical error.
-    ContentCache(const ContentCache &RHS) 
+    ContentCache(const ContentCache &RHS)
       : Buffer(0, false), SourceLineCache(0), MacroArgsCache(0)
     {
       OrigEntry = RHS.OrigEntry;
@@ -393,7 +393,7 @@
   /// entry from being loaded.
   virtual bool ReadSLocEntry(int ID) = 0;
 };
-  
+
 
 /// IsBeforeInTranslationUnitCache - This class holds the cache used by
 /// isBeforeInTranslationUnit.  The cache structure is complex enough to be
@@ -410,20 +410,20 @@
   /// CommonFID - This is the file found in common between the two #include
   /// traces.  It is the nearest common ancestor of the #include tree.
   FileID CommonFID;
-  
+
   /// L/R CommonOffset - This is the offset of the previous query in CommonFID.
   /// Usually, this represents the location of the #include for QueryFID, but if
   /// LQueryFID is a parent of RQueryFID (or vise versa) then these can be a
   /// random token in the parent.
   unsigned LCommonOffset, RCommonOffset;
 public:
-  
+
   /// isCacheValid - Return true if the currently cached values match up with
   /// the specified LHS/RHS query.  If not, we can't use the cache.
   bool isCacheValid(FileID LHS, FileID RHS) const {
     return LQueryFID == LHS && RQueryFID == RHS;
   }
-  
+
   /// getCachedResult - If the cache is valid, compute the result given the
   /// specified offsets in the LHS/RHS FID's.
   bool getCachedResult(unsigned LOffset, unsigned ROffset) const {
@@ -440,7 +440,7 @@
 
     return LOffset < ROffset;
   }
-  
+
   // Set up a new query.
   void setQueryFIDs(FileID LHS, FileID RHS, bool isLFIDBeforeRFID) {
     assert(LHS != RHS);
@@ -453,14 +453,14 @@
     LQueryFID = RQueryFID = FileID();
     IsLQFIDBeforeRQFID = false;
   }
-  
+
   void setCommonLoc(FileID commonFID, unsigned lCommonOffset,
                     unsigned rCommonOffset) {
     CommonFID = commonFID;
     LCommonOffset = lCommonOffset;
     RCommonOffset = rCommonOffset;
   }
-  
+
 };
 
 /// \brief This class handles loading and caching of source files into memory.
@@ -564,7 +564,7 @@
 
   // Cache for the "fake" buffer used for error-recovery purposes.
   mutable llvm::MemoryBuffer *FakeBufferForRecovery;
-  
+
   // SourceManager doesn't support copy construction.
   explicit SourceManager(const SourceManager&);
   void operator=(const SourceManager&);
@@ -613,7 +613,7 @@
     assert(MainFileID.isInvalid() && "MainFileID already set!");
     MainFileID = Preamble;
   }
-  
+
   //===--------------------------------------------------------------------===//
   // Methods to create new FileID's and macro expansions.
   //===--------------------------------------------------------------------===//
@@ -700,11 +700,11 @@
     if (MyInvalid || !Entry.isFile()) {
       if (Invalid)
         *Invalid = true;
-      
+
       return getFakeBufferForRecovery();
     }
-        
-    return Entry.getFile().getContentCache()->getBuffer(Diag, *this, Loc, 
+
+    return Entry.getFile().getContentCache()->getBuffer(Diag, *this, Loc,
                                                         Invalid);
   }
 
@@ -714,22 +714,22 @@
     if (MyInvalid || !Entry.isFile()) {
       if (Invalid)
         *Invalid = true;
-      
+
       return getFakeBufferForRecovery();
     }
 
-    return Entry.getFile().getContentCache()->getBuffer(Diag, *this, 
-                                                        SourceLocation(), 
+    return Entry.getFile().getContentCache()->getBuffer(Diag, *this,
+                                                        SourceLocation(),
                                                         Invalid);
   }
-  
+
   /// getFileEntryForID - Returns the FileEntry record for the provided FileID.
   const FileEntry *getFileEntryForID(FileID FID) const {
     bool MyInvalid = false;
     const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &MyInvalid);
     if (MyInvalid || !Entry.isFile())
       return 0;
-    
+
     return Entry.getFile().getContentCache()->OrigEntry;
   }
 
@@ -795,7 +795,7 @@
     const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid);
     if (Invalid || !Entry.isFile())
       return SourceLocation();
-    
+
     unsigned FileOffset = Entry.getOffset();
     return SourceLocation::getFileLoc(FileOffset);
   }
@@ -807,7 +807,7 @@
     const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid);
     if (Invalid || !Entry.isFile())
       return SourceLocation();
-    
+
     return Entry.getFile().getIncludeLoc();
   }
 
@@ -956,7 +956,7 @@
   /// returns zero if the column number isn't known.  This may only be called
   /// on a file sloc, so you must choose a spelling or expansion location
   /// before calling this method.
-  unsigned getColumnNumber(FileID FID, unsigned FilePos, 
+  unsigned getColumnNumber(FileID FID, unsigned FilePos,
                            bool *Invalid = 0) const;
   unsigned getSpellingColumnNumber(SourceLocation Loc, bool *Invalid = 0) const;
   unsigned getExpansionColumnNumber(SourceLocation Loc,
@@ -1074,11 +1074,11 @@
   size_t getContentCacheSize() const {
     return ContentCacheAlloc.getTotalMemory();
   }
-  
+
   struct MemoryBufferSizes {
     const size_t malloc_bytes;
     const size_t mmap_bytes;
-    
+
     MemoryBufferSizes(size_t malloc_bytes, size_t mmap_bytes)
       : malloc_bytes(malloc_bytes), mmap_bytes(mmap_bytes) {}
   };
@@ -1086,7 +1086,7 @@
   /// Return the amount of memory used by memory buffers, breaking down
   /// by heap-backed versus mmap'ed memory.
   MemoryBufferSizes getMemoryBufferSizes() const;
-  
+
   // Return the amount of memory used for various side tables and
   // data structures in the SourceManager.
   size_t getDataStructureSizes() const;
@@ -1108,7 +1108,7 @@
     SourceLocation Loc = translateFileLineCol(SourceFile, Line, Col);
     return getMacroArgExpandedLocation(Loc);
   }
-  
+
   /// \brief Get the source location for the given file:line:col triplet.
   ///
   /// If the source file is included multiple times, the source location will
@@ -1154,14 +1154,14 @@
   /// \brief Determines the order of a source location and a source location
   /// offset in the "source location address space".
   ///
-  /// Note that we always consider source locations loaded from 
+  /// Note that we always consider source locations loaded from
   bool isBeforeInSLocAddrSpace(SourceLocation LHS, unsigned RHS) const {
     unsigned LHSOffset = LHS.getOffset();
     bool LHSLoaded = LHSOffset >= CurrentLoadedOffset;
     bool RHSLoaded = RHS >= CurrentLoadedOffset;
     if (LHSLoaded == RHSLoaded)
       return LHSOffset < RHS;
-    
+
     return LHSLoaded;
   }
 
@@ -1180,17 +1180,17 @@
 
   /// \brief Get the number of local SLocEntries we have.
   unsigned local_sloc_entry_size() const { return LocalSLocEntryTable.size(); }
-  
+
   /// \brief Get a local SLocEntry. This is exposed for indexing.
-  const SrcMgr::SLocEntry &getLocalSLocEntry(unsigned Index, 
+  const SrcMgr::SLocEntry &getLocalSLocEntry(unsigned Index,
                                              bool *Invalid = 0) const {
     assert(Index < LocalSLocEntryTable.size() && "Invalid index");
     return LocalSLocEntryTable[Index];
   }
-  
+
   /// \brief Get the number of loaded SLocEntries we have.
   unsigned loaded_sloc_entry_size() const { return LoadedSLocEntryTable.size();}
-  
+
   /// \brief Get a loaded SLocEntry. This is exposed for indexing.
   const SrcMgr::SLocEntry &getLoadedSLocEntry(unsigned Index, bool *Invalid=0) const {
     assert(Index < LoadedSLocEntryTable.size() && "Invalid index");
@@ -1198,19 +1198,19 @@
       ExternalSLocEntries->ReadSLocEntry(-(static_cast<int>(Index) + 2));
     return LoadedSLocEntryTable[Index];
   }
-  
+
   const SrcMgr::SLocEntry &getSLocEntry(FileID FID, bool *Invalid = 0) const {
     return getSLocEntryByID(FID.ID);
   }
 
   unsigned getNextLocalOffset() const { return NextLocalOffset; }
-  
+
   void setExternalSLocEntrySource(ExternalSLocEntrySource *Source) {
     assert(LoadedSLocEntryTable.empty() &&
            "Invalidating existing loaded entries");
     ExternalSLocEntries = Source;
   }
-  
+
   /// \brief Allocate a number of loaded SLocEntries, which will be actually
   /// loaded on demand from the external source.
   ///
@@ -1219,7 +1219,7 @@
   /// entries will be returned.
   std::pair<int, unsigned>
   AllocateLoadedSLocEntries(unsigned NumSLocEntries, unsigned TotalSize);
-  
+
 private:
   const llvm::MemoryBuffer *getFakeBufferForRecovery() const;
 
@@ -1230,11 +1230,11 @@
       return getLoadedSLocEntryByID(ID);
     return getLocalSLocEntry(static_cast<unsigned>(ID));
   }
-  
+
   const SrcMgr::SLocEntry &getLoadedSLocEntryByID(int ID) const {
     return getLoadedSLocEntry(static_cast<unsigned>(-ID - 2));
   }
-  
+
   /// createExpansionLoc - Implements the common elements of storing an
   /// expansion info struct into the SLocEntry table and producing a source
   /// location that refers to it.





More information about the cfe-commits mailing list