diff options
author | Erik Verbruggen <erikjv@me.com> | 2016-10-25 10:06:11 +0000 |
---|---|---|
committer | Erik Verbruggen <erikjv@me.com> | 2016-10-25 10:06:11 +0000 |
commit | 0d99b1f50a9fc7f93df476e7c963ee3c1646affe (patch) | |
tree | 27d1c91ff6ca3eee042da93db842cb624b8dbe52 /lib/AST/CommentLexer.cpp | |
parent | 8134af3a6663e478314314c53dd125c6e498a135 (diff) | |
download | clang-0d99b1f50a9fc7f93df476e7c963ee3c1646affe.tar.gz |
Fix 'unknown documentation command' warning ranges
Warnings generated by -Wdocumentation-unknown-command did only have a
start location, not a full source range. This resulted in only the
"carret" being show in messages, and IDEs highlighting only the single
initial character.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/CommentLexer.cpp')
-rw-r--r-- | lib/AST/CommentLexer.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/AST/CommentLexer.cpp b/lib/AST/CommentLexer.cpp index 57bfef08df..65d0f56f09 100644 --- a/lib/AST/CommentLexer.cpp +++ b/lib/AST/CommentLexer.cpp @@ -378,15 +378,17 @@ void Lexer::lexCommentText(Token &T) { if ((Info = Traits.getTypoCorrectCommandInfo(CommandName))) { StringRef CorrectedName = Info->Name; SourceLocation Loc = getSourceLocation(BufferPtr); - SourceRange CommandRange(Loc.getLocWithOffset(1), - getSourceLocation(TokenPtr)); + SourceLocation EndLoc = getSourceLocation(TokenPtr); + SourceRange FullRange = SourceRange(Loc, EndLoc); + SourceRange CommandRange(Loc.getLocWithOffset(1), EndLoc); Diag(Loc, diag::warn_correct_comment_command_name) - << CommandName << CorrectedName + << FullRange << CommandName << CorrectedName << FixItHint::CreateReplacement(CommandRange, CorrectedName); } else { formTokenWithChars(T, TokenPtr, tok::unknown_command); T.setUnknownCommandName(CommandName); - Diag(T.getLocation(), diag::warn_unknown_comment_command_name); + Diag(T.getLocation(), diag::warn_unknown_comment_command_name) + << SourceRange(T.getLocation(), T.getEndLocation()); return; } } |