summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorMalcolm Parsons <malcolm.parsons@gmail.com>2016-10-20 14:58:45 +0000
committerMalcolm Parsons <malcolm.parsons@gmail.com>2016-10-20 14:58:45 +0000
commit5d8cdb83db58829bacc8d5478030b41a20acaf19 (patch)
tree56b891d82af1a5ef752bc404a74c781259259a3c /clang/lib
parentc1b73a1793b63a4cc67e6db9412a9c6cc85ef956 (diff)
downloadbcm5719-llvm-5d8cdb83db58829bacc8d5478030b41a20acaf19.tar.gz
bcm5719-llvm-5d8cdb83db58829bacc8d5478030b41a20acaf19.zip
[Format] Cleanup after replacing constructor body with = default
Summary: Remove colon and commas after replacing constructor body with = default. Fix annotation of TT_CtorInitializerColon when preceded by a comment. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D25768 llvm-svn: 284732
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/Format.cpp1
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp3
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index dfcd677cf89..99a192341c6 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1024,6 +1024,7 @@ public:
cleanupLeft(Line->First, tok::comma, tok::r_paren);
cleanupLeft(Line->First, TT_CtorInitializerComma, tok::l_brace);
cleanupLeft(Line->First, TT_CtorInitializerColon, tok::l_brace);
+ cleanupLeft(Line->First, TT_CtorInitializerColon, tok::equal);
}
}
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index ae054dd845c..abf7ff6b3b7 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -520,7 +520,8 @@ private:
Tok->Type = TT_BitFieldColon;
} else if (Contexts.size() == 1 &&
!Line.First->isOneOf(tok::kw_enum, tok::kw_case)) {
- if (Tok->Previous->isOneOf(tok::r_paren, tok::kw_noexcept))
+ if (Tok->getPreviousNonComment()->isOneOf(tok::r_paren,
+ tok::kw_noexcept))
Tok->Type = TT_CtorInitializerColon;
else
Tok->Type = TT_InheritanceColon;
OpenPOWER on IntegriCloud