[clang-tidy] Fix for http://llvm.org/PR23130
authorAlexander Kornienko <alexfh@google.com>
Wed, 8 Apr 2015 12:54:57 +0000 (12:54 +0000)
committerAlexander Kornienko <alexfh@google.com>
Wed, 8 Apr 2015 12:54:57 +0000 (12:54 +0000)
NamespaceCommentCheck: Don't remove the token placed immediately after the
namespace closing brace.

llvm-svn: 234403

clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp
clang-tools-extra/test/clang-tidy/google-readability-namespace-comments.cpp

index 69f456b..ba3b837 100644 (file)
@@ -129,9 +129,9 @@ void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) {
           : ("namespace '" + ND->getNameAsString() + "'");
 
   diag(AfterRBrace, Message)
-      << NamespaceName
-      << FixItHint::CreateReplacement(
-             OldCommentRange, std::string(SpacesBeforeComments, ' ') +
+      << NamespaceName << FixItHint::CreateReplacement(
+                              CharSourceRange::getCharRange(OldCommentRange),
+                              std::string(SpacesBeforeComments, ' ') +
                                   getNamespaceComment(ND, NeedLineBreak));
   diag(ND->getLocation(), "%0 starts here", DiagnosticIDs::Note)
       << NamespaceName;
index 0a50b49..0815edc 100644 (file)
@@ -10,10 +10,9 @@ namespace n2 {
 
 // CHECK-MESSAGES: :[[@LINE+4]]:2: warning: namespace 'n2' not terminated with a closing comment [google-readability-namespace-comments]
 // CHECK-MESSAGES: :[[@LINE-7]]:11: note: namespace 'n2' starts here
-// CHECK-MESSAGES: :[[@LINE+3]]:2: warning: namespace 'n1' not terminated with
+// CHECK-MESSAGES: :[[@LINE+2]]:3: warning: namespace 'n1' not terminated with
 // CHECK-MESSAGES: :[[@LINE-10]]:11: note: namespace 'n1' starts here
-}
-}
+}}
 // CHECK-FIXES: }  // namespace n2
 // CHECK-FIXES: }  // namespace n1