summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-07-11 14:33:06 +0000
committerDaniel Jasper <djasper@google.com>2013-07-11 14:33:06 +0000
commita3501d4b81c170d3b0fc7645a6f5357c24e517e7 (patch)
treee6276d2d47ae17385a1f805678ecbd63a9db480d /clang/lib/Format
parent889865fb699aa9d9cfd50d97239fd3fcf21f2f30 (diff)
downloadbcm5719-llvm-a3501d4b81c170d3b0fc7645a6f5357c24e517e7.tar.gz
bcm5719-llvm-a3501d4b81c170d3b0fc7645a6f5357c24e517e7.zip
Improve detection of trailing return types.
Trailing return types can only occur in declaration contexts. Before: void f() { auto a = b -> c(); } After: void f() { auto a = b->c(); } llvm-svn: 186087
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 1e4de6eb943..14206445fac 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -607,7 +607,8 @@ private:
NameFound = true;
} else if (Current.is(tok::kw_auto)) {
AutoFound = true;
- } else if (Current.is(tok::arrow) && AutoFound) {
+ } else if (Current.is(tok::arrow) && AutoFound &&
+ Line.MustBeDeclaration) {
Current.Type = TT_TrailingReturnArrow;
} else if (Current.isOneOf(tok::star, tok::amp, tok::ampamp)) {
Current.Type =
OpenPOWER on IntegriCloud