diff options
author | Daniel Jasper <djasper@google.com> | 2016-05-08 18:12:22 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2016-05-08 18:12:22 +0000 |
commit | a7900adf41f4fefefb71fa475e9728b3bd7a779d (patch) | |
tree | 2f3547da374243afb5cfa5bf5ccd27cf06c604b7 /clang/lib | |
parent | 4a9d32c5bab34d5ae64f521ea84470721edeb128 (diff) | |
download | bcm5719-llvm-a7900adf41f4fefefb71fa475e9728b3bd7a779d.tar.gz bcm5719-llvm-a7900adf41f4fefefb71fa475e9728b3bd7a779d.zip |
clang-format: Support enum type template arguments.
Before:
template <enum E> class A { public : E *f(); };
After:
template <enum E> class A {
public:
E *f();
};
llvm-svn: 268878
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index c6bf71adbf1..c8e4cc4a1b6 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -902,6 +902,7 @@ void UnwrappedLineParser::parseStructuralElement() { break; } do { + const FormatToken *Previous = getPreviousToken(); switch (FormatTok->Tok.getKind()) { case tok::at: nextToken(); @@ -909,6 +910,12 @@ void UnwrappedLineParser::parseStructuralElement() { parseBracedList(); break; case tok::kw_enum: + // Ignore if this is part of "template <enum ...". + if (Previous && Previous->is(tok::less)) { + nextToken(); + break; + } + // parseEnum falls through and does not yet add an unwrapped line as an // enum definition can start a structural element. if (!parseEnum()) |