summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-11-23 19:11:45 +0000
committerDaniel Jasper <djasper@google.com>2015-11-23 19:11:45 +0000
commit8e8b4fb678016640be0284f6aa73b8806fb76aec (patch)
treed8dad79b1cfbe12ebdfb6f5796e41d267091c7ec /clang/lib/Format
parenta96925322b9c71003c3ad7be3175d2e3dc64e1ec (diff)
downloadbcm5719-llvm-8e8b4fb678016640be0284f6aa73b8806fb76aec.tar.gz
bcm5719-llvm-8e8b4fb678016640be0284f6aa73b8806fb76aec.zip
clang-format: Re-add code path deleted in r253873 and add missing test.
llvm-svn: 253900
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index af87b3c3832..b5e7b9a0e65 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1068,6 +1068,15 @@ private:
FormatToken *LeftOfParens = Tok.MatchingParen->getPreviousNonComment();
if (LeftOfParens) {
+ // If there is an opening parenthesis left of the current parentheses,
+ // look past it as these might be chained casts.
+ if (LeftOfParens->is(tok::r_paren)) {
+ if (!LeftOfParens->MatchingParen ||
+ !LeftOfParens->MatchingParen->Previous)
+ return false;
+ LeftOfParens = LeftOfParens->MatchingParen->Previous;
+ }
+
// If there is an identifier (or with a few exceptions a keyword) right
// before the parentheses, this is unlikely to be a cast.
if (LeftOfParens->Tok.getIdentifierInfo() &&
OpenPOWER on IntegriCloud