diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-01 22:51:30 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-01 22:51:30 +0000 |
commit | c98e9130bcddd0258c110d30749edd2284087e3d (patch) | |
tree | b1bef38e783e38b9a92774dd24175d9a327cbc51 /lib | |
parent | fc09336a5965040736f9bc63a70416003972364e (diff) |
comment parsing. Keep the original command format
in AST for source fidelity and use it in diagnostics
to refer to the original format. // rdar://13066276
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176387 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/CommentLexer.cpp | 1 | ||||
-rw-r--r-- | lib/AST/CommentParser.cpp | 4 | ||||
-rw-r--r-- | lib/AST/CommentSema.cpp | 6 |
3 files changed, 11 insertions, 0 deletions
diff --git a/lib/AST/CommentLexer.cpp b/lib/AST/CommentLexer.cpp index cee086e103..da865d2ee3 100644 --- a/lib/AST/CommentLexer.cpp +++ b/lib/AST/CommentLexer.cpp @@ -298,6 +298,7 @@ void Lexer::lexCommentText(Token &T) { switch(*TokenPtr) { case '\\': case '@': { + T.HDCommand = (*TokenPtr == '@'); TokenPtr++; if (TokenPtr == CommentEnd) { formTextToken(T, TokenPtr); diff --git a/lib/AST/CommentParser.cpp b/lib/AST/CommentParser.cpp index 952c10c4a8..f5c933e7bb 100644 --- a/lib/AST/CommentParser.cpp +++ b/lib/AST/CommentParser.cpp @@ -313,15 +313,18 @@ BlockCommandComment *Parser::parseBlockCommand() { PC = S.actOnParamCommandStart(Tok.getLocation(), Tok.getEndLocation(), Tok.getCommandID()); + PC->setHDCommand(Tok.getHDCommand()); } else if (Info->IsTParamCommand) { IsTParam = true; TPC = S.actOnTParamCommandStart(Tok.getLocation(), Tok.getEndLocation(), Tok.getCommandID()); + TPC->setHDCommand(Tok.getHDCommand()); } else { BC = S.actOnBlockCommandStart(Tok.getLocation(), Tok.getEndLocation(), Tok.getCommandID()); + BC->setHDCommand(Tok.getHDCommand()); } consumeToken(); @@ -569,6 +572,7 @@ BlockContentComment *Parser::parseParagraphOrBlockCommand() { if (Info->IsVerbatimBlockEndCommand) { Diag(Tok.getLocation(), diag::warn_verbatim_block_end_without_start) + << Tok.getHDCommand() << Info->Name << SourceRange(Tok.getLocation(), Tok.getEndLocation()); consumeToken(); diff --git a/lib/AST/CommentSema.cpp b/lib/AST/CommentSema.cpp index 73e49e71db..3227138807 100644 --- a/lib/AST/CommentSema.cpp +++ b/lib/AST/CommentSema.cpp @@ -432,6 +432,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->getCommandName(Traits) << Command->getSourceRange(); } @@ -459,6 +460,7 @@ void Sema::checkReturnsCommand(const BlockCommandComment *Command) { } Diag(Command->getLocation(), diag::warn_doc_returns_attached_to_a_void_function) + << Command->getHDCommand() << Command->getCommandName(Traits) << DiagKind << Command->getSourceRange(); @@ -470,6 +472,7 @@ void Sema::checkReturnsCommand(const BlockCommandComment *Command) { Diag(Command->getLocation(), diag::warn_doc_returns_not_attached_to_a_function_decl) + << Command->getHDCommand() << Command->getCommandName(Traits) << Command->getSourceRange(); } @@ -502,15 +505,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() << CommandName << Command->getSourceRange(); if (CommandName == PrevCommandName) Diag(PrevCommand->getLocation(), diag::note_doc_block_command_previous) + << PrevCommand->getHDCommand() << PrevCommandName << PrevCommand->getSourceRange(); else Diag(PrevCommand->getLocation(), diag::note_doc_block_command_previous_alias) + << PrevCommand->getHDCommand() << PrevCommandName << CommandName; } |