diff options
author | Daniel Jasper <djasper@google.com> | 2014-11-19 14:11:11 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-11-19 14:11:11 +0000 |
commit | fe2cf6673a2b126409439c617cba7811dc75f7ba (patch) | |
tree | 8e02132b7cd007e4d0beb9bba0ac2f23cc9d3aec /clang/lib/Format/Format.cpp | |
parent | ffeed44190d8ff5c04f4bd0735589ab00fd70f8c (diff) | |
download | bcm5719-llvm-fe2cf6673a2b126409439c617cba7811dc75f7ba.tar.gz bcm5719-llvm-fe2cf6673a2b126409439c617cba7811dc75f7ba.zip |
clang-format: [Java] Ignore C++-specific keywords
Before:
public void union
(Object o);
public void struct
(Object o);
public void delete (Object o);
After:
public void union(Object o);
public void struct(Object o);
public void delete(Object o);
Patch by Harry Terkelsen, thank you!
llvm-svn: 222357
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index fe52fb58765..729ca97aabe 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1688,6 +1688,11 @@ private: IdentifierInfo &Info = IdentTable.get(FormatTok->TokenText); FormatTok->Tok.setIdentifierInfo(&Info); FormatTok->Tok.setKind(Info.getTokenID()); + if (Style.Language == FormatStyle::LK_Java && + FormatTok->isOneOf(tok::kw_struct, tok::kw_union, tok::kw_delete)) { + FormatTok->Tok.setKind(tok::identifier); + FormatTok->Tok.setIdentifierInfo(nullptr); + } } else if (FormatTok->Tok.is(tok::greatergreater)) { FormatTok->Tok.setKind(tok::greater); FormatTok->TokenText = FormatTok->TokenText.substr(0, 1); |