summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-10-12 05:16:06 +0000
committerDaniel Jasper <djasper@google.com>2013-10-12 05:16:06 +0000
commitfba84ff00d1fe7c56378eb665e5c09d050ba443d (patch)
tree9d64c37e3b71e9a1106203e5cd8425277d8537b1 /clang/lib/Format
parented699259989868985a1a220d745161576242f4c9 (diff)
downloadbcm5719-llvm-fba84ff00d1fe7c56378eb665e5c09d050ba443d.tar.gz
bcm5719-llvm-fba84ff00d1fe7c56378eb665e5c09d050ba443d.zip
clang-format: No space in "<::" in C++11 mode.
llvm-svn: 192524
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/Format.cpp12
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp5
2 files changed, 11 insertions, 6 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index aac9fffb01e..7e92a705cad 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1012,10 +1012,14 @@ private:
++CountBoundToType;
}
- if (Tok->Type == TT_TemplateCloser &&
- Tok->Previous->Type == TT_TemplateCloser &&
- Tok->WhitespaceRange.getBegin() == Tok->WhitespaceRange.getEnd())
- HasCpp03IncompatibleFormat = true;
+ if (Tok->WhitespaceRange.getBegin() == Tok->WhitespaceRange.getEnd()) {
+ if (Tok->is(tok::coloncolon) &&
+ Tok->Previous->Type == TT_TemplateOpener)
+ HasCpp03IncompatibleFormat = true;
+ if (Tok->Type == TT_TemplateCloser &&
+ Tok->Previous->Type == TT_TemplateCloser)
+ HasCpp03IncompatibleFormat = true;
+ }
if (Tok->PackingKind == PPK_BinPacked)
HasBinPackedFunction = true;
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index e1ffc25f633..4d95ecfe4f9 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1231,8 +1231,9 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
if (Left.is(tok::coloncolon))
return false;
if (Right.is(tok::coloncolon))
- return !Left.isOneOf(tok::identifier, tok::greater, tok::l_paren,
- tok::r_paren);
+ return (Left.is(tok::less) && Style.Standard == FormatStyle::LS_Cpp03) ||
+ !Left.isOneOf(tok::identifier, tok::greater, tok::l_paren,
+ tok::r_paren, tok::less);
if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less))
return false;
if (Right.is(tok::ellipsis))
OpenPOWER on IntegriCloud