diff options
author | Krasimir Georgiev <krasimir@google.com> | 2018-11-13 15:38:12 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2018-11-13 15:38:12 +0000 |
commit | 3919b8d9833d23d98e8be71fe608627866d5c40c (patch) | |
tree | 954fcd0dc3269928631bdba1083033ca57eec5a0 /lib/Format/TokenAnnotator.cpp | |
parent | 27ccc9daf4d4a73c77e50d86af93355c97085813 (diff) |
[clang-format] Do not treat the asm clobber [ as ObjCExpr
Summary:
The opening square of an inline asm clobber was being annotated as an ObjCExpr.
This caused, amongst other things, the ObjCGuesser to guess header files
containing that pattern as ObjC files.
Reviewers: benhamilton
Reviewed By: benhamilton
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D54111
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346756 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | lib/Format/TokenAnnotator.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index fe614300c2..705ee1582c 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -404,8 +404,9 @@ private: Contexts.back().CanBeExpression && Left->isNot(TT_LambdaLSquare) && !CurrentToken->isOneOf(tok::l_brace, tok::r_square) && (!Parent || - Parent->isOneOf(tok::colon, tok::l_square, tok::l_paren, - tok::kw_return, tok::kw_throw) || + (Parent->is(tok::colon) && Parent->isNot(TT_InlineASMColon)) || + Parent->isOneOf(tok::l_square, tok::l_paren, tok::kw_return, + tok::kw_throw) || Parent->isUnaryOperator() || // FIXME(bug 36976): ObjC return types shouldn't use TT_CastRParen. Parent->isOneOf(TT_ObjCForIn, TT_CastRParen) || |