aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-02-23 08:07:18 +0000
committerDaniel Jasper <djasper@google.com>2013-02-23 08:07:18 +0000
commit37eff83413a064c504c5a42097e4f5dd0b2962d2 (patch)
tree435c5cb766867725395d7bfa3cf9b8e8eb2bf128 /lib/Format/TokenAnnotator.cpp
parent3a204418482c9ae70ad482e781132c54306c3aa6 (diff)
Don't recognize unnamed pointer parameters as casts.
This fixes llvm.org/PR15061. Before: virtual void f(int *)const; After: virtual void f(int *) const; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/TokenAnnotator.cpp')
-rw-r--r--lib/Format/TokenAnnotator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 359923f02f..80780185c0 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -602,7 +602,8 @@ private:
!Current.Children.empty() && (Current.Children[0].is(tok::equal) ||
Current.Children[0].is(tok::semi) ||
Current.Children[0].is(tok::l_brace));
- if (ParensNotExpr && !ParensCouldEndDecl)
+ if (ParensNotExpr && !ParensCouldEndDecl &&
+ Contexts.back().IsExpression)
// FIXME: We need to get smarter and understand more cases of casts.
Current.Type = TT_CastRParen;
} else if (Current.is(tok::at) && Current.Children.size()) {