summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-02-08 16:49:27 +0000
committerDaniel Jasper <djasper@google.com>2013-02-08 16:49:27 +0000
commit8360a86c8c7a123705e7b3a078f8b5f26d6ed3ee (patch)
treecd34dbc53b7478fe1f34076f4cead2da54f8e2a6 /clang/lib/Format
parenta6016e4351ca88eceef7133fd3d6ae8a9241f8f3 (diff)
downloadbcm5719-llvm-8360a86c8c7a123705e7b3a078f8b5f26d6ed3ee.tar.gz
bcm5719-llvm-8360a86c8c7a123705e7b3a078f8b5f26d6ed3ee.zip
Fix handling of fake parenthesis during formatting.
They are much easier to handle when attached to the previous token. Before: unsigned Indent = formatFirstToken(TheLine.First, IndentForLevel[TheLine.Level] >= 0 ? IndentForLevel[TheLine.Level] : TheLine.Level * 2, TheLine.InPPDirective, PreviousEndOfLineColumn); After: unsigned Indent = formatFirstToken( TheLine.First, IndentForLevel[TheLine.Level] >= 0 ? IndentForLevel[TheLine.Level] : TheLine.Level * 2, TheLine.InPPDirective, PreviousEndOfLineColumn); llvm-svn: 174718
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp2
-rw-r--r--clang/lib/Format/TokenAnnotator.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 485624b7faa..db059018c26 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -722,7 +722,7 @@ public:
if (OperatorFound) {
++Start->FakeLParens;
if (Current != NULL)
- ++Current->FakeRParens;
+ ++Current->Parent->FakeRParens;
}
return;
}
diff --git a/clang/lib/Format/TokenAnnotator.h b/clang/lib/Format/TokenAnnotator.h
index dc936e48b5c..85e41021c21 100644
--- a/clang/lib/Format/TokenAnnotator.h
+++ b/clang/lib/Format/TokenAnnotator.h
@@ -121,7 +121,7 @@ public:
/// \brief Insert this many fake ( before this token for correct indentation.
unsigned FakeLParens;
- /// \brief Insert this many fake ) before this token for correct indentation.
+ /// \brief Insert this many fake ) after this token for correct indentation.
unsigned FakeRParens;
const AnnotatedToken *getPreviousNoneComment() const {
OpenPOWER on IntegriCloud