[llvm-commits] [llvm] r94671 - in /llvm/trunk: include/llvm/Support/SourceMgr.h lib/Support/SourceMgr.cpp

Mikhail Glushenkov foldr at codedgers.com
Wed Jan 27 02:13:12 PST 2010


Author: foldr
Date: Wed Jan 27 04:13:11 2010
New Revision: 94671

URL: http://llvm.org/viewvc/llvm-project?rev=94671&view=rev
Log:
Trailing whitespace.

Modified:
    llvm/trunk/include/llvm/Support/SourceMgr.h
    llvm/trunk/lib/Support/SourceMgr.cpp

Modified: llvm/trunk/include/llvm/Support/SourceMgr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=94671&r1=94670&r2=94671&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/SourceMgr.h (original)
+++ llvm/trunk/include/llvm/Support/SourceMgr.h Wed Jan 27 04:13:11 2010
@@ -34,33 +34,33 @@
   struct SrcBuffer {
     /// Buffer - The memory buffer for the file.
     MemoryBuffer *Buffer;
-    
+
     /// IncludeLoc - This is the location of the parent include, or null if at
     /// the top level.
     SMLoc IncludeLoc;
   };
-  
+
   /// Buffers - This is all of the buffers that we are reading from.
   std::vector<SrcBuffer> Buffers;
-  
+
   // IncludeDirectories - This is the list of directories we should search for
   // include files in.
   std::vector<std::string> IncludeDirectories;
-  
+
   /// LineNoCache - This is a cache for line number queries, its implementation
   /// is really private to SourceMgr.cpp.
   mutable void *LineNoCache;
-  
+
   SourceMgr(const SourceMgr&);    // DO NOT IMPLEMENT
   void operator=(const SourceMgr&); // DO NOT IMPLEMENT
 public:
   SourceMgr() : LineNoCache(0) {}
   ~SourceMgr();
-  
+
   void setIncludeDirs(const std::vector<std::string> &Dirs) {
     IncludeDirectories = Dirs;
   }
-  
+
   const SrcBuffer &getBufferInfo(unsigned i) const {
     assert(i < Buffers.size() && "Invalid Buffer ID!");
     return Buffers[i];
@@ -70,12 +70,12 @@
     assert(i < Buffers.size() && "Invalid Buffer ID!");
     return Buffers[i].Buffer;
   }
-  
+
   SMLoc getParentIncludeLoc(unsigned i) const {
     assert(i < Buffers.size() && "Invalid Buffer ID!");
     return Buffers[i].IncludeLoc;
   }
-  
+
   unsigned AddNewSourceBuffer(MemoryBuffer *F, SMLoc IncludeLoc) {
     SrcBuffer NB;
     NB.Buffer = F;
@@ -83,20 +83,20 @@
     Buffers.push_back(NB);
     return Buffers.size()-1;
   }
-  
+
   /// AddIncludeFile - Search for a file with the specified name in the current
   /// directory or in one of the IncludeDirs.  If no file is found, this returns
   /// ~0, otherwise it returns the buffer ID of the stacked file.
   unsigned AddIncludeFile(const std::string &Filename, SMLoc IncludeLoc);
-  
+
   /// FindBufferContainingLoc - Return the ID of the buffer containing the
   /// specified location, returning -1 if not found.
   int FindBufferContainingLoc(SMLoc Loc) const;
-  
+
   /// FindLineNumber - Find the line number for the specified location in the
   /// specified file.  This is not a fast method.
   unsigned FindLineNumber(SMLoc Loc, int BufferID = -1) const;
-  
+
   /// PrintMessage - Emit a message about the specified location with the
   /// specified string.
   ///
@@ -105,8 +105,8 @@
   /// @param ShowLine - Should the diagnostic show the source line.
   void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type,
                     bool ShowLine = true) const;
-  
-  
+
+
   /// GetMessage - Return an SMDiagnostic at the specified location with the
   /// specified string.
   ///
@@ -116,13 +116,13 @@
   SMDiagnostic GetMessage(SMLoc Loc,
                           const std::string &Msg, const char *Type,
                           bool ShowLine = true) const;
-  
-  
+
+
 private:
   void PrintIncludeStack(SMLoc IncludeLoc, raw_ostream &OS) const;
 };
 
-  
+
 /// SMDiagnostic - Instances of this class encapsulate one diagnostic report,
 /// allowing printing to a raw_ostream as a caret diagnostic.
 class SMDiagnostic {
@@ -141,7 +141,7 @@
 
   void Print(const char *ProgName, raw_ostream &S);
 };
-  
+
 }  // end llvm namespace
 
 #endif

Modified: llvm/trunk/lib/Support/SourceMgr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=94671&r1=94670&r2=94671&view=diff

==============================================================================
--- llvm/trunk/lib/Support/SourceMgr.cpp (original)
+++ llvm/trunk/lib/Support/SourceMgr.cpp Wed Jan 27 04:13:11 2010
@@ -35,7 +35,7 @@
   // Delete the line # cache if allocated.
   if (LineNoCacheTy *Cache = getCache(LineNoCache))
     delete Cache;
-    
+
   while (!Buffers.empty()) {
     delete Buffers.back().Buffer;
     Buffers.pop_back();
@@ -47,7 +47,7 @@
 /// ~0, otherwise it returns the buffer ID of the stacked file.
 unsigned SourceMgr::AddIncludeFile(const std::string &Filename,
                                    SMLoc IncludeLoc) {
-  
+
   MemoryBuffer *NewBuf = MemoryBuffer::getFile(Filename.c_str());
 
   // If the file didn't exist directly, see if it's in an include path.
@@ -55,7 +55,7 @@
     std::string IncFile = IncludeDirectories[i] + "/" + Filename;
     NewBuf = MemoryBuffer::getFile(IncFile.c_str());
   }
- 
+
   if (NewBuf == 0) return ~0U;
 
   return AddNewSourceBuffer(NewBuf, IncludeLoc);
@@ -79,20 +79,20 @@
 unsigned SourceMgr::FindLineNumber(SMLoc Loc, int BufferID) const {
   if (BufferID == -1) BufferID = FindBufferContainingLoc(Loc);
   assert(BufferID != -1 && "Invalid Location!");
-  
+
   MemoryBuffer *Buff = getBufferInfo(BufferID).Buffer;
-  
+
   // Count the number of \n's between the start of the file and the specified
   // location.
   unsigned LineNo = 1;
-  
+
   const char *Ptr = Buff->getBufferStart();
 
   // If we have a line number cache, and if the query is to a later point in the
   // same file, start searching from the last query location.  This optimizes
   // for the case when multiple diagnostics come out of one file in order.
   if (LineNoCacheTy *Cache = getCache(LineNoCache))
-    if (Cache->LastQueryBufferID == BufferID && 
+    if (Cache->LastQueryBufferID == BufferID &&
         Cache->LastQuery <= Loc.getPointer()) {
       Ptr = Cache->LastQuery;
       LineNo = Cache->LineNoOfQuery;
@@ -102,12 +102,12 @@
   // we see.
   for (; SMLoc::getFromPointer(Ptr) != Loc; ++Ptr)
     if (*Ptr == '\n') ++LineNo;
-  
-  
+
+
   // Allocate the line number cache if it doesn't exist.
   if (LineNoCache == 0)
     LineNoCache = new LineNoCacheTy();
-  
+
   // Update the line # cache.
   LineNoCacheTy &Cache = *getCache(LineNoCache);
   Cache.LastQueryBufferID = BufferID;
@@ -118,12 +118,12 @@
 
 void SourceMgr::PrintIncludeStack(SMLoc IncludeLoc, raw_ostream &OS) const {
   if (IncludeLoc == SMLoc()) return;  // Top of stack.
-  
+
   int CurBuf = FindBufferContainingLoc(IncludeLoc);
   assert(CurBuf != -1 && "Invalid or unspecified location!");
 
   PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc, OS);
-  
+
   OS << "Included from "
      << getBufferInfo(CurBuf).Buffer->getBufferIdentifier()
      << ":" << FindLineNumber(IncludeLoc, CurBuf) << ":\n";
@@ -137,12 +137,12 @@
 /// prefixed to the message.
 SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, const std::string &Msg,
                                    const char *Type, bool ShowLine) const {
-  
+
   // First thing to do: find the current buffer containing the specified
   // location.
   int CurBuf = FindBufferContainingLoc(Loc);
   assert(CurBuf != -1 && "Invalid or unspecified location!");
-  
+
   MemoryBuffer *CurMB = getBufferInfo(CurBuf).Buffer;
 
   // Scan backward to find the start of the line.
@@ -160,7 +160,7 @@
       ++LineEnd;
     LineStr = std::string(LineStart, LineEnd);
   }
-  
+
   std::string PrintedMsg;
   if (Type) {
     PrintedMsg = Type;
@@ -173,7 +173,7 @@
                       LineStr, ShowLine);
 }
 
-void SourceMgr::PrintMessage(SMLoc Loc, const std::string &Msg, 
+void SourceMgr::PrintMessage(SMLoc Loc, const std::string &Msg,
                              const char *Type, bool ShowLine) const {
   raw_ostream &OS = errs();
 
@@ -197,7 +197,7 @@
       S << "<stdin>";
     else
       S << Filename;
-  
+
     if (LineNo != -1) {
       S << ':' << LineNo;
       if (ColumnNo != -1)
@@ -205,12 +205,12 @@
     }
     S << ": ";
   }
-  
+
   S << Message << '\n';
 
   if (LineNo != -1 && ColumnNo != -1 && ShowLine) {
     S << LineContents << '\n';
-    
+
     // Print out spaces/tabs before the caret.
     for (unsigned i = 0; i != unsigned(ColumnNo); ++i)
       S << (LineContents[i] == '\t' ? '\t' : ' ');





More information about the llvm-commits mailing list