diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/google/TodoCommentCheck.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/google/TodoCommentCheck.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-tidy/google/TodoCommentCheck.cpp b/clang-tools-extra/clang-tidy/google/TodoCommentCheck.cpp index 8554870..7331b36 100644 --- a/clang-tools-extra/clang-tidy/google/TodoCommentCheck.cpp +++ b/clang-tools-extra/clang-tidy/google/TodoCommentCheck.cpp @@ -20,7 +20,7 @@ public: TodoMatch("^// *TODO *(\\(.*\\))?:?( )?(.*)$") {} bool HandleComment(Preprocessor &PP, SourceRange Range) override { - StringRef Text = + const StringRef Text = Lexer::getSourceText(CharSourceRange::getCharRange(Range), PP.getSourceManager(), PP.getLangOpts()); @@ -28,13 +28,14 @@ public: if (!TodoMatch.match(Text, &Matches)) return false; - StringRef Username = Matches[1]; - StringRef Comment = Matches[3]; + const StringRef Username = Matches[1]; + const StringRef Comment = Matches[3]; if (!Username.empty()) return false; - std::string NewText = ("// TODO(" + Twine(User) + "): " + Comment).str(); + const std::string NewText = + ("// TODO(" + Twine(User) + "): " + Comment).str(); Check.diag(Range.getBegin(), "missing username/bug in TODO") << FixItHint::CreateReplacement(CharSourceRange::getCharRange(Range), |
