r185823 - Reformat clang-format's source files after r185822 and others.

Daniel Jasper djasper at google.com
Mon Jul 8 07:34:09 PDT 2013


Author: djasper
Date: Mon Jul  8 09:34:09 2013
New Revision: 185823

URL: http://llvm.org/viewvc/llvm-project?rev=185823&view=rev
Log:
Reformat clang-format's source files after r185822 and others.

Modified:
    cfe/trunk/lib/Format/BreakableToken.cpp
    cfe/trunk/lib/Format/BreakableToken.h
    cfe/trunk/lib/Format/Encoding.h
    cfe/trunk/lib/Format/Format.cpp
    cfe/trunk/lib/Format/FormatToken.h
    cfe/trunk/lib/Format/TokenAnnotator.cpp
    cfe/trunk/lib/Format/UnwrappedLineParser.h
    cfe/trunk/lib/Format/WhitespaceManager.cpp
    cfe/trunk/lib/Format/WhitespaceManager.h

Modified: cfe/trunk/lib/Format/BreakableToken.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/BreakableToken.cpp?rev=185823&r1=185822&r2=185823&view=diff
==============================================================================
--- cfe/trunk/lib/Format/BreakableToken.cpp (original)
+++ cfe/trunk/lib/Format/BreakableToken.cpp Mon Jul  8 09:34:09 2013
@@ -28,13 +28,13 @@ namespace format {
 static const char *const Blanks = " \t\v\f";
 static bool IsBlank(char C) {
   switch (C) {
-    case ' ':
-    case '\t':
-    case '\v':
-    case '\f':
-      return true;
-    default:
-      return false;
+  case ' ':
+  case '\t':
+  case '\v':
+  case '\f':
+    return true;
+  default:
+    return false;
   }
 }
 
@@ -388,9 +388,9 @@ BreakableBlockComment::replaceWhitespace
     }
   }
 
-  unsigned WhitespaceOffsetInToken =
-      Lines[LineIndex].data() - Tok.TokenText.data() -
-      LeadingWhitespace[LineIndex];
+  unsigned WhitespaceOffsetInToken = Lines[LineIndex].data() -
+                                     Tok.TokenText.data() -
+                                     LeadingWhitespace[LineIndex];
   assert(StartOfLineColumn[LineIndex] >= Prefix.size());
   Whitespaces.replaceWhitespaceInToken(
       Tok, WhitespaceOffsetInToken, LeadingWhitespace[LineIndex], "", Prefix,

Modified: cfe/trunk/lib/Format/BreakableToken.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/BreakableToken.h?rev=185823&r1=185822&r2=185823&view=diff
==============================================================================
--- cfe/trunk/lib/Format/BreakableToken.h (original)
+++ cfe/trunk/lib/Format/BreakableToken.h Mon Jul  8 09:34:09 2013
@@ -48,8 +48,8 @@ public:
   /// specified from the start of the (original) line.
   /// \p Length can be set to StringRef::npos, which means "to the end of line".
   virtual unsigned
-      getLineLengthAfterSplit(unsigned LineIndex, unsigned Offset,
-                              StringRef::size_type Length) const = 0;
+  getLineLengthAfterSplit(unsigned LineIndex, unsigned Offset,
+                          StringRef::size_type Length) const = 0;
 
   /// \brief Returns a range (offset, length) at which to break the line at
   /// \p LineIndex, if previously broken at \p TailOffset. If possible, do not

Modified: cfe/trunk/lib/Format/Encoding.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Encoding.h?rev=185823&r1=185822&r2=185823&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Encoding.h (original)
+++ cfe/trunk/lib/Format/Encoding.h Mon Jul  8 09:34:09 2013
@@ -50,10 +50,10 @@ inline unsigned getCodePointCountUTF8(St
 /// Encoding.
 inline unsigned getCodePointCount(StringRef Text, Encoding Encoding) {
   switch (Encoding) {
-    case Encoding_UTF8:
-      return getCodePointCountUTF8(Text);
-    default:
-      return Text.size();
+  case Encoding_UTF8:
+    return getCodePointCountUTF8(Text);
+  default:
+    return Text.size();
   }
 }
 
@@ -61,16 +61,14 @@ inline unsigned getCodePointCount(String
 /// codepoint and starting with FirstChar in the specified Encoding.
 inline unsigned getCodePointNumBytes(char FirstChar, Encoding Encoding) {
   switch (Encoding) {
-    case Encoding_UTF8:
-      return getNumBytesForUTF8(FirstChar);
-    default:
-      return 1;
+  case Encoding_UTF8:
+    return getNumBytesForUTF8(FirstChar);
+  default:
+    return 1;
   }
 }
 
-inline bool isOctDigit(char c) {
-  return '0' <= c && c <= '7';
-}
+inline bool isOctDigit(char c) { return '0' <= c && c <= '7'; }
 
 inline bool isHexDigit(char c) {
   return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') ||

Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=185823&r1=185822&r2=185823&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Mon Jul  8 09:34:09 2013
@@ -271,9 +271,9 @@ public:
     LineState State;
     State.Column = FirstIndent;
     State.NextToken = RootToken;
-    State.Stack.push_back(
-        ParenState(FirstIndent, FirstIndent, /*AvoidBinPacking=*/false,
-                   /*NoLineBreak=*/false));
+    State.Stack.push_back(ParenState(FirstIndent, FirstIndent,
+                                     /*AvoidBinPacking=*/false,
+                                     /*NoLineBreak=*/false));
     State.LineContainsContinuedForLoopSection = false;
     State.ParenLevel = 0;
     State.StartOfStringLiteral = 0;
@@ -1289,9 +1289,9 @@ public:
           !AnnotatedLines[i].First->Next)
         AnnotatedLines[i].Level = NextNonCommentLine->Level;
       else
-        NextNonCommentLine =
-            AnnotatedLines[i].First->isNot(tok::r_brace) ? &AnnotatedLines[i]
-                                                         : NULL;
+        NextNonCommentLine = AnnotatedLines[i].First->isNot(tok::r_brace)
+                                 ? &AnnotatedLines[i]
+                                 : NULL;
     }
 
     std::vector<int> IndentForLevel;

Modified: cfe/trunk/lib/Format/FormatToken.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/FormatToken.h?rev=185823&r1=185822&r2=185823&view=diff
==============================================================================
--- cfe/trunk/lib/Format/FormatToken.h (original)
+++ cfe/trunk/lib/Format/FormatToken.h Mon Jul  8 09:34:09 2013
@@ -212,7 +212,6 @@ struct FormatToken {
   bool opensScope() const {
     return isOneOf(tok::l_paren, tok::l_brace, tok::l_square) ||
            Type == TT_TemplateOpener;
-
   }
   /// \brief Returns whether \p Tok is )]} or a template closing >.
   bool closesScope() const {

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=185823&r1=185822&r2=185823&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Jul  8 09:34:09 2013
@@ -542,9 +542,9 @@ private:
     ScopedContextCreator(AnnotatingParser &P, tok::TokenKind ContextKind,
                          unsigned Increase)
         : P(P) {
-      P.Contexts.push_back(
-          Context(ContextKind, P.Contexts.back().BindingStrength + Increase,
-                  P.Contexts.back().IsExpression));
+      P.Contexts.push_back(Context(ContextKind,
+                                   P.Contexts.back().BindingStrength + Increase,
+                                   P.Contexts.back().IsExpression));
     }
 
     ~ScopedContextCreator() { P.Contexts.pop_back(); }
@@ -625,8 +625,7 @@ private:
         if (ParensAreType && !ParensCouldEndDecl && !IsSizeOfOrAlignOf &&
             Contexts.back().IsExpression)
           IsCast = true;
-        if (Current.Next &&
-            Current.Next->isNot(tok::string_literal) &&
+        if (Current.Next && Current.Next->isNot(tok::string_literal) &&
             (Current.Next->Tok.isLiteral() ||
              Current.Next->isOneOf(tok::kw_sizeof, tok::kw_alignof)))
           IsCast = true;
@@ -678,9 +677,9 @@ private:
     if (PreviousNotConst == NULL)
       return false;
 
-    bool IsPPKeyword =
-        PreviousNotConst->is(tok::identifier) && PreviousNotConst->Previous &&
-        PreviousNotConst->Previous->is(tok::hash);
+    bool IsPPKeyword = PreviousNotConst->is(tok::identifier) &&
+                       PreviousNotConst->Previous &&
+                       PreviousNotConst->Previous->is(tok::hash);
 
     return (!IsPPKeyword && PreviousNotConst->is(tok::identifier)) ||
            PreviousNotConst->Type == TT_PointerOrReference ||
@@ -952,9 +951,9 @@ void TokenAnnotator::calculateFormatting
     if (Current->MustBreakBefore)
       Current->TotalLength = Current->Previous->TotalLength + Style.ColumnLimit;
     else
-      Current->TotalLength =
-          Current->Previous->TotalLength + Current->CodePointCount +
-          Current->SpacesRequiredBefore;
+      Current->TotalLength = Current->Previous->TotalLength +
+                             Current->CodePointCount +
+                             Current->SpacesRequiredBefore;
     // FIXME: Only calculate this if CanBreakBefore is true once static
     // initializers etc. are sorted out.
     // FIXME: Move magic numbers to a better place.

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.h?rev=185823&r1=185822&r2=185823&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.h (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.h Mon Jul  8 09:34:09 2013
@@ -31,8 +31,7 @@ namespace format {
 /// \c UnwrappedLineFormatter. The key property is that changing the formatting
 /// within an unwrapped line does not affect any other unwrapped lines.
 struct UnwrappedLine {
-  UnwrappedLine() : Level(0), InPPDirective(false), MustBeDeclaration(false) {
-  }
+  UnwrappedLine() : Level(0), InPPDirective(false), MustBeDeclaration(false) {}
 
   // FIXME: Don't use std::list here.
   /// \brief The \c Tokens comprising this \c UnwrappedLine.
@@ -49,8 +48,7 @@ struct UnwrappedLine {
 
 class UnwrappedLineConsumer {
 public:
-  virtual ~UnwrappedLineConsumer() {
-  }
+  virtual ~UnwrappedLineConsumer() {}
   virtual void consumeUnwrappedLine(const UnwrappedLine &Line) = 0;
 };
 
@@ -163,8 +161,8 @@ private:
   // Represents preprocessor branch type, so we can find matching
   // #if/#else/#endif directives.
   enum PPBranchKind {
-    PP_Conditional,  // Any #if, #ifdef, #ifndef, #elif, block outside #if 0
-    PP_Unreachable   // #if 0 or a conditional preprocessor block inside #if 0
+    PP_Conditional, // Any #if, #ifdef, #ifndef, #elif, block outside #if 0
+    PP_Unreachable  // #if 0 or a conditional preprocessor block inside #if 0
   };
 
   // Keeps a stack of currently active preprocessor branching directives.

Modified: cfe/trunk/lib/Format/WhitespaceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/WhitespaceManager.cpp?rev=185823&r1=185822&r2=185823&view=diff
==============================================================================
--- cfe/trunk/lib/Format/WhitespaceManager.cpp (original)
+++ cfe/trunk/lib/Format/WhitespaceManager.cpp Mon Jul  8 09:34:09 2013
@@ -42,9 +42,9 @@ void WhitespaceManager::replaceWhitespac
                                           unsigned Newlines, unsigned Spaces,
                                           unsigned StartOfTokenColumn,
                                           bool InPPDirective) {
-  Changes.push_back(
-      Change(true, Tok.WhitespaceRange, Spaces, StartOfTokenColumn, Newlines,
-             "", "", Tok.Tok.getKind(), InPPDirective && !Tok.IsFirst));
+  Changes.push_back(Change(true, Tok.WhitespaceRange, Spaces,
+                           StartOfTokenColumn, Newlines, "", "",
+                           Tok.Tok.getKind(), InPPDirective && !Tok.IsFirst));
 }
 
 void WhitespaceManager::addUntouchableToken(const FormatToken &Tok,
@@ -94,10 +94,10 @@ void WhitespaceManager::calculateLineBre
         SourceMgr.getFileOffset(Changes[i].OriginalWhitespaceRange.getBegin());
     unsigned PreviousOriginalWhitespaceEnd = SourceMgr.getFileOffset(
         Changes[i - 1].OriginalWhitespaceRange.getEnd());
-    Changes[i - 1].TokenLength =
-        OriginalWhitespaceStart - PreviousOriginalWhitespaceEnd +
-        Changes[i].PreviousLinePostfix.size() +
-        Changes[i - 1].CurrentLinePrefix.size();
+    Changes[i - 1].TokenLength = OriginalWhitespaceStart -
+                                 PreviousOriginalWhitespaceEnd +
+                                 Changes[i].PreviousLinePostfix.size() +
+                                 Changes[i - 1].CurrentLinePrefix.size();
 
     Changes[i].PreviousEndOfTokenColumn =
         Changes[i - 1].StartOfTokenColumn + Changes[i - 1].TokenLength;
@@ -242,8 +242,7 @@ void WhitespaceManager::storeReplacement
                               SourceMgr.getFileOffset(Range.getBegin());
   // Don't create a replacement, if it does not change anything.
   if (StringRef(SourceMgr.getCharacterData(Range.getBegin()),
-                WhitespaceLength) ==
-      Text)
+                WhitespaceLength) == Text)
     return;
   Replaces.insert(tooling::Replacement(
       SourceMgr, CharSourceRange::getCharRange(Range), Text));

Modified: cfe/trunk/lib/Format/WhitespaceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/WhitespaceManager.h?rev=185823&r1=185822&r2=185823&view=diff
==============================================================================
--- cfe/trunk/lib/Format/WhitespaceManager.h (original)
+++ cfe/trunk/lib/Format/WhitespaceManager.h Mon Jul  8 09:34:09 2013
@@ -75,11 +75,11 @@ private:
   struct Change {
     /// \brief Functor to sort changes in original source order.
     class IsBeforeInFile {
-     public:
+    public:
       IsBeforeInFile(const SourceManager &SourceMgr) : SourceMgr(SourceMgr) {}
       bool operator()(const Change &C1, const Change &C2) const;
 
-     private:
+    private:
       const SourceManager &SourceMgr;
     };
 
@@ -126,7 +126,6 @@ private:
     unsigned TokenLength;
     unsigned PreviousEndOfTokenColumn;
     unsigned EscapedNewlineColumn;
-
   };
 
   /// \brief Calculate \c IsTrailingComment, \c TokenLength for the last tokens





More information about the cfe-commits mailing list