[clang-tools-extra] r234403 - [clang-tidy] Fix for http://llvm.org/PR23130

Alexander Kornienko alexfh at google.com
Wed Apr 8 05:54:58 PDT 2015


Author: alexfh
Date: Wed Apr  8 07:54:57 2015
New Revision: 234403

URL: http://llvm.org/viewvc/llvm-project?rev=234403&view=rev
Log:
[clang-tidy] Fix for http://llvm.org/PR23130

NamespaceCommentCheck: Don't remove the token placed immediately after the
namespace closing brace.


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

Modified: clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp?rev=234403&r1=234402&r2=234403&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp Wed Apr  8 07:54:57 2015
@@ -129,9 +129,9 @@ void NamespaceCommentCheck::check(const
           : ("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;

Modified: clang-tools-extra/trunk/test/clang-tidy/google-readability-namespace-comments.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-readability-namespace-comments.cpp?rev=234403&r1=234402&r2=234403&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/google-readability-namespace-comments.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/google-readability-namespace-comments.cpp Wed Apr  8 07:54:57 2015
@@ -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
 





More information about the cfe-commits mailing list