summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2012-12-05 13:56:52 +0000
committerAlexander Kornienko <alexfh@google.com>2012-12-05 13:56:52 +0000
commitbc09a7ea8535dbd57b34da434ea4c7ea8810341f (patch)
tree77a781ed5d1e9cfff0bed9494574477cc178fd78
parent1a6f4d4ba61748a2f1e84cafb75be54a5d55ca65 (diff)
downloadbcm5719-llvm-bc09a7ea8535dbd57b34da434ea4c7ea8810341f.tar.gz
bcm5719-llvm-bc09a7ea8535dbd57b34da434ea4c7ea8810341f.zip
Follow-up to r169286, addresses comments in http://llvm-reviews.chandlerc.com/D164#comment-4 : comments and a method rename
llvm-svn: 169382
-rw-r--r--clang/lib/Format/Format.cpp9
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp3
-rw-r--r--clang/lib/Format/UnwrappedLineParser.h2
3 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 22805f691e9..78450469f5b 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -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;
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index e1972e9dd85..bdea42a2eb4 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -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();
}
diff --git a/clang/lib/Format/UnwrappedLineParser.h b/clang/lib/Format/UnwrappedLineParser.h
index 20ff4f55d69..6e9d8723867 100644
--- a/clang/lib/Format/UnwrappedLineParser.h
+++ b/clang/lib/Format/UnwrappedLineParser.h
@@ -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 {
OpenPOWER on IntegriCloud