summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/readability
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability')
-rw-r--r--clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp5
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)
OpenPOWER on IntegriCloud