Follow-up to r169286, addresses comments in http://llvm-reviews.chandlerc.com/D164...
authorAlexander Kornienko <alexfh@google.com>
Wed, 5 Dec 2012 13:56:52 +0000 (13:56 +0000)
committerAlexander Kornienko <alexfh@google.com>
Wed, 5 Dec 2012 13:56:52 +0000 (13:56 +0000)
llvm-svn: 169382

clang/lib/Format/Format.cpp
clang/lib/Format/UnwrappedLineParser.cpp
clang/lib/Format/UnwrappedLineParser.h

index 22805f6..7845046 100644 (file)
@@ -315,7 +315,8 @@ private:
   }
 
   /// \brief Add a new line and the required indent before the first Token
-  /// of the \c UnwrappedLine.
+  /// of the \c UnwrappedLine if there was no structural parsing error.
+  /// Returns the indent level of the \c UnwrappedLine.
   unsigned formatFirstToken() {
     const FormatToken &Token = Line.Tokens[0];
     if (!Token.WhiteSpaceStart.isValid() || StructuralError)
@@ -706,16 +707,16 @@ public:
     for (std::vector<UnwrappedLine>::iterator I = UnwrappedLines.begin(),
                                               E = UnwrappedLines.end();
          I != E; ++I)
-      doFormatUnwrappedLine(*I);
+      formatUnwrappedLine(*I);
     return Replaces;
   }
 
 private:
-  virtual void formatUnwrappedLine(const UnwrappedLine &TheLine) {
+  virtual void consumeUnwrappedLine(const UnwrappedLine &TheLine) {
     UnwrappedLines.push_back(TheLine);
   }
 
-  void doFormatUnwrappedLine(const UnwrappedLine &TheLine) {
+  void formatUnwrappedLine(const UnwrappedLine &TheLine) {
     if (TheLine.Tokens.size() == 0)
       return;
 
index e1972e9..bdea42a 100644 (file)
@@ -52,6 +52,7 @@ bool UnwrappedLineParser::parseLevel() {
       addUnwrappedLine();
       break;
     case tok::r_brace:
+      // FIXME: We need a test when it has to be "return Error;"
       return false;
     default:
       parseStatement();
@@ -318,7 +319,7 @@ void UnwrappedLineParser::addUnwrappedLine() {
          FormatTok.Tok.is(tok::comment)) {
     nextToken();
   }
-  Callback.formatUnwrappedLine(Line);
+  Callback.consumeUnwrappedLine(Line);
   Line.Tokens.clear();
 }
 
index 20ff4f5..6e9d872 100644 (file)
@@ -73,7 +73,7 @@ class UnwrappedLineConsumer {
 public:
   virtual ~UnwrappedLineConsumer() {
   }
-  virtual void formatUnwrappedLine(const UnwrappedLine &Line) = 0;
+  virtual void consumeUnwrappedLine(const UnwrappedLine &Line) = 0;
 };
 
 class UnwrappedLineParser {