diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-05-03 23:15:20 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-05-03 23:15:20 +0000 |
commit | ad6fd9f93ce0d328397e8d57ef7117ced24fc8e2 (patch) | |
tree | ff65aa9339d215a60b3a59212e7795cc6fcec093 /lib/AST | |
parent | cc2b653c319599f502425d2c3de29865d47bb9e4 (diff) |
[Doc parsing] Provide diagnostics for unknown documentation
commands. // rdar://12381408
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181071 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST')
-rw-r--r-- | lib/AST/CommentLexer.cpp | 8 | ||||
-rw-r--r-- | lib/AST/RawCommentList.cpp | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/AST/CommentLexer.cpp b/lib/AST/CommentLexer.cpp index 1194520bf3..82efac64ff 100644 --- a/lib/AST/CommentLexer.cpp +++ b/lib/AST/CommentLexer.cpp @@ -1,4 +1,5 @@ #include "clang/AST/CommentLexer.h" +#include "clang/Lex/LexDiagnostic.h" #include "clang/AST/CommentCommandTraits.h" #include "clang/Basic/CharInfo.h" #include "llvm/ADT/StringExtras.h" @@ -353,6 +354,8 @@ void Lexer::lexCommentText(Token &T) { if (!Info) { formTokenWithChars(T, TokenPtr, tok::unknown_command); T.setUnknownCommandName(CommandName); + Diag(T.getLocation(), + diag::warn_unknown_comment_command_name); return; } if (Info->IsVerbatimBlockCommand) { @@ -685,10 +688,11 @@ void Lexer::lexHTMLEndTag(Token &T) { State = LS_Normal; } -Lexer::Lexer(llvm::BumpPtrAllocator &Allocator, const CommandTraits &Traits, +Lexer::Lexer(llvm::BumpPtrAllocator &Allocator, DiagnosticsEngine &Diags, + const CommandTraits &Traits, SourceLocation FileLoc, const char *BufferStart, const char *BufferEnd): - Allocator(Allocator), Traits(Traits), + Allocator(Allocator), Diags(Diags), Traits(Traits), BufferStart(BufferStart), BufferEnd(BufferEnd), FileLoc(FileLoc), BufferPtr(BufferStart), CommentState(LCS_BeforeComment), State(LS_Normal) { diff --git a/lib/AST/RawCommentList.cpp b/lib/AST/RawCommentList.cpp index fb85c142e3..92b96dc8e5 100644 --- a/lib/AST/RawCommentList.cpp +++ b/lib/AST/RawCommentList.cpp @@ -146,7 +146,8 @@ const char *RawComment::extractBriefText(const ASTContext &Context) const { // a separate allocator for all temporary stuff. llvm::BumpPtrAllocator Allocator; - comments::Lexer L(Allocator, Context.getCommentCommandTraits(), + comments::Lexer L(Allocator, Context.getDiagnostics(), + Context.getCommentCommandTraits(), Range.getBegin(), RawText.begin(), RawText.end()); comments::BriefParser P(L, Context.getCommentCommandTraits()); @@ -167,7 +168,8 @@ comments::FullComment *RawComment::parse(const ASTContext &Context, // Make sure that RawText is valid. getRawText(Context.getSourceManager()); - comments::Lexer L(Context.getAllocator(), Context.getCommentCommandTraits(), + comments::Lexer L(Context.getAllocator(), Context.getDiagnostics(), + Context.getCommentCommandTraits(), getSourceRange().getBegin(), RawText.begin(), RawText.end()); comments::Sema S(Context.getAllocator(), Context.getSourceManager(), |