diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-08-09 00:03:17 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-08-09 00:03:17 +0000 |
commit | aa58081902ad31927df02e8537d972eabe29d6df (patch) | |
tree | b6f5f6acf0c80eaec20a2131369fd81026ede6a0 /lib/AST/CommentParser.cpp | |
parent | 42f74f21ece01dc8573d5377859d327fbb23b26c (diff) |
Comment parsing: extract TableGen'able pieces into new CommandTraits class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161548 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/CommentParser.cpp')
-rw-r--r-- | lib/AST/CommentParser.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/AST/CommentParser.cpp b/lib/AST/CommentParser.cpp index eb1027a9b6..43abf6a476 100644 --- a/lib/AST/CommentParser.cpp +++ b/lib/AST/CommentParser.cpp @@ -10,6 +10,7 @@ #include "clang/AST/CommentParser.h" #include "clang/AST/CommentSema.h" #include "clang/AST/CommentDiagnostic.h" +#include "clang/AST/CommentCommandTraits.h" #include "clang/Basic/SourceManager.h" #include "llvm/Support/ErrorHandling.h" @@ -250,8 +251,10 @@ public: }; Parser::Parser(Lexer &L, Sema &S, llvm::BumpPtrAllocator &Allocator, - const SourceManager &SourceMgr, DiagnosticsEngine &Diags): - L(L), S(S), Allocator(Allocator), SourceMgr(SourceMgr), Diags(Diags) { + const SourceManager &SourceMgr, DiagnosticsEngine &Diags, + const CommandTraits &Traits): + L(L), S(S), Allocator(Allocator), SourceMgr(SourceMgr), Diags(Diags), + Traits(Traits) { consumeToken(); } @@ -310,25 +313,25 @@ BlockCommandComment *Parser::parseBlockCommand() { bool IsParam = false; bool IsTParam = false; unsigned NumArgs = 0; - if (S.isParamCommand(Tok.getCommandName())) { + if (Traits.isParamCommand(Tok.getCommandName())) { IsParam = true; PC = S.actOnParamCommandStart(Tok.getLocation(), Tok.getEndLocation(), Tok.getCommandName()); - } if (S.isTParamCommand(Tok.getCommandName())) { + } if (Traits.isTParamCommand(Tok.getCommandName())) { IsTParam = true; TPC = S.actOnTParamCommandStart(Tok.getLocation(), Tok.getEndLocation(), Tok.getCommandName()); } else { - NumArgs = S.getBlockCommandNumArgs(Tok.getCommandName()); + NumArgs = Traits.getBlockCommandNumArgs(Tok.getCommandName()); BC = S.actOnBlockCommandStart(Tok.getLocation(), Tok.getEndLocation(), Tok.getCommandName()); } consumeToken(); - if (Tok.is(tok::command) && S.isBlockCommand(Tok.getCommandName())) { + if (Tok.is(tok::command) && Traits.isBlockCommand(Tok.getCommandName())) { // Block command ahead. We can't nest block commands, so pretend that this // command has an empty argument. ParagraphComment *Paragraph = S.actOnParagraphComment( @@ -538,12 +541,12 @@ BlockContentComment *Parser::parseParagraphOrBlockCommand() { break; // Block content or EOF ahead, finish this parapgaph. case tok::command: - if (S.isBlockCommand(Tok.getCommandName())) { + if (Traits.isBlockCommand(Tok.getCommandName())) { if (Content.size() == 0) return parseBlockCommand(); break; // Block command ahead, finish this parapgaph. } - if (S.isInlineCommand(Tok.getCommandName())) { + if (Traits.isInlineCommand(Tok.getCommandName())) { Content.push_back(parseInlineCommand()); continue; } |