diff options
| author | Artem Dergachev <artem.dergachev@gmail.com> | 2019-04-23 21:15:26 +0000 |
|---|---|---|
| committer | Artem Dergachev <artem.dergachev@gmail.com> | 2019-04-23 21:15:26 +0000 |
| commit | 8c099ce72d480fbff943613c7482992449fafe2d (patch) | |
| tree | 8267c823a4c59b202a1fba84bf73bd4b39c764f5 /clang-tools-extra/clang-tidy/readability | |
| parent | fc79ab9857adc96d243cc5ed0a641eef8ef3f253 (diff) | |
| download | bcm5719-llvm-8c099ce72d480fbff943613c7482992449fafe2d.tar.gz bcm5719-llvm-8c099ce72d480fbff943613c7482992449fafe2d.zip | |
Re-apply r357823 "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."
It now comes with a follow-up fix for the clients of this API
in clangd and clang-tidy.
Differential Revision: https://reviews.llvm.org/D59977
llvm-svn: 359035
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability')
| -rw-r--r-- | clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp b/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp index 17184ec21b9..6428f8cdc98 100644 --- a/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp @@ -102,11 +102,14 @@ void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) { } } + // FIXME: This probably breaks on comments between the namespace and its '{'. auto TextRange = Lexer::getAsCharRange(SourceRange(NestedNamespaceBegin, LBracketLocation), Sources, getLangOpts()); StringRef NestedNamespaceName = - Lexer::getSourceText(TextRange, Sources, getLangOpts()).rtrim(); + Lexer::getSourceText(TextRange, Sources, getLangOpts()) + .rtrim('{') // Drop the { itself. + .rtrim(); // Drop any whitespace before it. bool IsNested = NestedNamespaceName.contains(':'); if (IsNested) |

