Align superclasses for multiple inheritence.
This fixes llvm.org/PR15179.
Before:
class ColorChooserMac : public content::ColorChooser,
public content::WebContentsObserver {
};
After:
class ColorChooserMac : public content::ColorChooser,
public content::WebContentsObserver {
};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175147 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 4c36536..22e67df 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -323,6 +323,8 @@
Contexts.back().FirstObjCSelectorName = Tok->Parent;
} else if (Contexts.back().ColonIsForRangeExpr) {
Tok->Type = TT_RangeBasedForLoopColon;
+ } else if (Contexts.size() == 1) {
+ Tok->Type = TT_InheritanceColon;
}
break;
case tok::kw_if:
@@ -856,7 +858,8 @@
if (Left.is(tok::coloncolon))
return 500;
- if (Left.Type == TT_RangeBasedForLoopColon)
+ if (Left.Type == TT_RangeBasedForLoopColon ||
+ Left.Type == TT_InheritanceColon)
return 5;
if (Right.is(tok::arrow) || Right.is(tok::period)) {
@@ -1040,7 +1043,11 @@
return true;
if (Right.Type == TT_ConditionalExpr || Right.is(tok::question))
return true;
- if (Left.Type == TT_RangeBasedForLoopColon)
+ if (Right.Type == TT_RangeBasedForLoopColon ||
+ Right.Type == TT_InheritanceColon)
+ return false;
+ if (Left.Type == TT_RangeBasedForLoopColon ||
+ Left.Type == TT_InheritanceColon)
return true;
if (Left.Type == TT_PointerOrReference || Left.Type == TT_TemplateCloser ||
Left.Type == TT_UnaryOperator || Left.Type == TT_ConditionalExpr ||