diff options
| author | Daniel Jasper <djasper@google.com> | 2013-03-22 10:44:43 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-03-22 10:44:43 +0000 |
| commit | 399d1ee5a01c2d0e7584105a23c25c0ff899a022 (patch) | |
| tree | 0c55815bd1f6f5a8af1a1c2628dd652477447d60 /clang/lib/Format | |
| parent | cdd35a905026edb161c7ef9284b11a198510fc20 (diff) | |
| download | bcm5719-llvm-399d1ee5a01c2d0e7584105a23c25c0ff899a022.tar.gz bcm5719-llvm-399d1ee5a01c2d0e7584105a23c25c0ff899a022.zip | |
More precisely recognize ObjC method declarations.
Otherwise, +/- and the beginning of constants can be recognized
incorrectly.
Before: #define A - 1
After: #define A -1
llvm-svn: 177725
Diffstat (limited to 'clang/lib/Format')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 3578162c3f6..7e3ef75d3dc 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -313,9 +313,11 @@ private: switch (Tok->FormatTok.Tok.getKind()) { case tok::plus: case tok::minus: - // At the start of the line, +/- specific ObjectiveC method - // declarations. - if (Tok->Parent == NULL) + // At the start of the line, +/- specify ObjectiveC method declarations. + if (Tok->Children.empty() || Tok->Children[0].Children.empty()) + break; // Can't be an ObjectiveC method declaration. + if (Tok->Parent == NULL && (Tok->Children[0].is(tok::l_paren) || + Tok->Children[0].Children[0].is(tok::colon))) Tok->Type = TT_ObjCMethodSpecifier; break; case tok::colon: |

