[cfe-commits] r169382 - in /cfe/trunk/lib/Format: Format.cpp UnwrappedLineParser.cpp UnwrappedLineParser.h
Alexander Kornienko
alexfh at google.com
Wed Dec 5 05:56:52 PST 2012
Author: alexfh
Date: Wed Dec 5 07:56:52 2012
New Revision: 169382
URL: http://llvm.org/viewvc/llvm-project?rev=169382&view=rev
Log:
Follow-up to r169286, addresses comments in http://llvm-reviews.chandlerc.com/D164#comment-4 : comments and a method rename
Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/lib/Format/UnwrappedLineParser.h
Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=169382&r1=169381&r2=169382&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Dec 5 07:56:52 2012
@@ -315,7 +315,8 @@
}
/// \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 @@
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;
Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=169382&r1=169381&r2=169382&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Wed Dec 5 07:56:52 2012
@@ -52,6 +52,7 @@
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 @@
FormatTok.Tok.is(tok::comment)) {
nextToken();
}
- Callback.formatUnwrappedLine(Line);
+ Callback.consumeUnwrappedLine(Line);
Line.Tokens.clear();
}
Modified: cfe/trunk/lib/Format/UnwrappedLineParser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.h?rev=169382&r1=169381&r2=169382&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.h (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.h Wed Dec 5 07:56:52 2012
@@ -73,7 +73,7 @@
public:
virtual ~UnwrappedLineConsumer() {
}
- virtual void formatUnwrappedLine(const UnwrappedLine &Line) = 0;
+ virtual void consumeUnwrappedLine(const UnwrappedLine &Line) = 0;
};
class UnwrappedLineParser {
More information about the cfe-commits
mailing list