diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/CommentBriefParser.cpp | 2 | ||||
-rw-r--r-- | lib/AST/CommentLexer.cpp | 6 | ||||
-rw-r--r-- | lib/AST/CommentParser.cpp | 24 | ||||
-rw-r--r-- | lib/AST/CommentSema.cpp | 27 |
4 files changed, 33 insertions, 26 deletions
diff --git a/lib/AST/CommentBriefParser.cpp b/lib/AST/CommentBriefParser.cpp index 95daa7e3f8..090b9211d4 100644 --- a/lib/AST/CommentBriefParser.cpp +++ b/lib/AST/CommentBriefParser.cpp @@ -78,7 +78,7 @@ std::string BriefParser::Parse() { continue; } - if (Tok.is(tok::command)) { + if (Tok.is(tok::backslash_command) || Tok.is(tok::at_command)) { const CommandInfo *Info = Traits.getCommandInfo(Tok.getCommandID()); if (Info->IsBriefCommand) { FirstParagraphOrBrief.clear(); diff --git a/lib/AST/CommentLexer.cpp b/lib/AST/CommentLexer.cpp index da865d2ee3..2018099417 100644 --- a/lib/AST/CommentLexer.cpp +++ b/lib/AST/CommentLexer.cpp @@ -298,7 +298,7 @@ void Lexer::lexCommentText(Token &T) { switch(*TokenPtr) { case '\\': case '@': { - T.HDCommand = (*TokenPtr == '@'); + bool AtCommand = (*TokenPtr == '@'); TokenPtr++; if (TokenPtr == CommentEnd) { formTextToken(T, TokenPtr); @@ -359,7 +359,9 @@ void Lexer::lexCommentText(Token &T) { setupAndLexVerbatimLine(T, TokenPtr, Info); return; } - formTokenWithChars(T, TokenPtr, tok::command); + formTokenWithChars(T, TokenPtr, + (AtCommand ? tok::at_command + : tok::backslash_command)); T.setCommandID(Info->getID()); return; } diff --git a/lib/AST/CommentParser.cpp b/lib/AST/CommentParser.cpp index f5c933e7bb..c6bd922461 100644 --- a/lib/AST/CommentParser.cpp +++ b/lib/AST/CommentParser.cpp @@ -300,7 +300,7 @@ void Parser::parseBlockCommandArgs(BlockCommandComment *BC, } BlockCommandComment *Parser::parseBlockCommand() { - assert(Tok.is(tok::command)); + assert(Tok.is(tok::backslash_command) || Tok.is(tok::at_command)); ParamCommandComment *PC; TParamCommandComment *TPC; @@ -312,19 +312,19 @@ BlockCommandComment *Parser::parseBlockCommand() { IsParam = true; PC = S.actOnParamCommandStart(Tok.getLocation(), Tok.getEndLocation(), - Tok.getCommandID()); - PC->setHDCommand(Tok.getHDCommand()); + Tok.getCommandID(), + Tok.is(tok::at_command)); } else if (Info->IsTParamCommand) { IsTParam = true; TPC = S.actOnTParamCommandStart(Tok.getLocation(), Tok.getEndLocation(), - Tok.getCommandID()); - TPC->setHDCommand(Tok.getHDCommand()); + Tok.getCommandID(), + Tok.is(tok::at_command)); } else { BC = S.actOnBlockCommandStart(Tok.getLocation(), Tok.getEndLocation(), - Tok.getCommandID()); - BC->setHDCommand(Tok.getHDCommand()); + Tok.getCommandID(), + Tok.is(tok::at_command)); } consumeToken(); @@ -395,7 +395,7 @@ BlockCommandComment *Parser::parseBlockCommand() { } InlineCommandComment *Parser::parseInlineCommand() { - assert(Tok.is(tok::command)); + assert(Tok.is(tok::backslash_command) || Tok.is(tok::at_command)); const Token CommandTok = Tok; consumeToken(); @@ -562,7 +562,8 @@ BlockContentComment *Parser::parseParagraphOrBlockCommand() { consumeToken(); continue; - case tok::command: { + case tok::backslash_command: + case tok::at_command: { const CommandInfo *Info = Traits.getCommandInfo(Tok.getCommandID()); if (Info->IsBlockCommand) { if (Content.size() == 0) @@ -572,7 +573,7 @@ BlockContentComment *Parser::parseParagraphOrBlockCommand() { if (Info->IsVerbatimBlockEndCommand) { Diag(Tok.getLocation(), diag::warn_verbatim_block_end_without_start) - << Tok.getHDCommand() + << Tok.is(tok::at_command) << Info->Name << SourceRange(Tok.getLocation(), Tok.getEndLocation()); consumeToken(); @@ -710,7 +711,8 @@ BlockContentComment *Parser::parseBlockContent() { switch (Tok.getKind()) { case tok::text: case tok::unknown_command: - case tok::command: + case tok::backslash_command: + case tok::at_command: case tok::html_start_tag: case tok::html_end_tag: return parseParagraphOrBlockCommand(); diff --git a/lib/AST/CommentSema.cpp b/lib/AST/CommentSema.cpp index 3227138807..e7bd5c8cad 100644 --- a/lib/AST/CommentSema.cpp +++ b/lib/AST/CommentSema.cpp @@ -49,8 +49,9 @@ ParagraphComment *Sema::actOnParagraphComment( BlockCommandComment *Sema::actOnBlockCommandStart(SourceLocation LocBegin, SourceLocation LocEnd, - unsigned CommandID) { - return new (Allocator) BlockCommandComment(LocBegin, LocEnd, CommandID); + unsigned CommandID, + bool AtCommand) { + return new (Allocator) BlockCommandComment(LocBegin, LocEnd, CommandID, AtCommand); } void Sema::actOnBlockCommandArgs(BlockCommandComment *Command, @@ -69,9 +70,10 @@ void Sema::actOnBlockCommandFinish(BlockCommandComment *Command, ParamCommandComment *Sema::actOnParamCommandStart(SourceLocation LocBegin, SourceLocation LocEnd, - unsigned CommandID) { + unsigned CommandID, + bool AtCommand) { ParamCommandComment *Command = - new (Allocator) ParamCommandComment(LocBegin, LocEnd, CommandID); + new (Allocator) ParamCommandComment(LocBegin, LocEnd, CommandID, AtCommand); if (!isFunctionDecl()) Diag(Command->getLocation(), @@ -162,9 +164,10 @@ void Sema::actOnParamCommandFinish(ParamCommandComment *Command, TParamCommandComment *Sema::actOnTParamCommandStart(SourceLocation LocBegin, SourceLocation LocEnd, - unsigned CommandID) { + unsigned CommandID, + bool AtCommand) { TParamCommandComment *Command = - new (Allocator) TParamCommandComment(LocBegin, LocEnd, CommandID); + new (Allocator) TParamCommandComment(LocBegin, LocEnd, CommandID, AtCommand); if (!isTemplateOrSpecialization()) Diag(Command->getLocation(), @@ -432,7 +435,7 @@ void Sema::checkBlockCommandEmptyParagraph(BlockCommandComment *Command) { if (!DiagLoc.isValid()) DiagLoc = Command->getCommandNameRange(Traits).getEnd(); Diag(DiagLoc, diag::warn_doc_block_command_empty_paragraph) - << Command->getHDCommand() + << Command->getAtCommand() << Command->getCommandName(Traits) << Command->getSourceRange(); } @@ -460,7 +463,7 @@ void Sema::checkReturnsCommand(const BlockCommandComment *Command) { } Diag(Command->getLocation(), diag::warn_doc_returns_attached_to_a_void_function) - << Command->getHDCommand() + << Command->getAtCommand() << Command->getCommandName(Traits) << DiagKind << Command->getSourceRange(); @@ -472,7 +475,7 @@ void Sema::checkReturnsCommand(const BlockCommandComment *Command) { Diag(Command->getLocation(), diag::warn_doc_returns_not_attached_to_a_function_decl) - << Command->getHDCommand() + << Command->getAtCommand() << Command->getCommandName(Traits) << Command->getSourceRange(); } @@ -505,18 +508,18 @@ void Sema::checkBlockCommandDuplicate(const BlockCommandComment *Command) { StringRef CommandName = Command->getCommandName(Traits); StringRef PrevCommandName = PrevCommand->getCommandName(Traits); Diag(Command->getLocation(), diag::warn_doc_block_command_duplicate) - << Command->getHDCommand() + << Command->getAtCommand() << CommandName << Command->getSourceRange(); if (CommandName == PrevCommandName) Diag(PrevCommand->getLocation(), diag::note_doc_block_command_previous) - << PrevCommand->getHDCommand() + << PrevCommand->getAtCommand() << PrevCommandName << PrevCommand->getSourceRange(); else Diag(PrevCommand->getLocation(), diag::note_doc_block_command_previous_alias) - << PrevCommand->getHDCommand() + << PrevCommand->getAtCommand() << PrevCommandName << CommandName; } |