From: Alexander Kornienko Date: Wed, 8 Apr 2015 12:54:57 +0000 (+0000) Subject: [clang-tidy] Fix for http://llvm.org/PR23130 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66d7e30b3c1ccc02232086b6d19c4350be592192;p=platform%2Fupstream%2Fllvm.git [clang-tidy] Fix for http://llvm.org/PR23130 NamespaceCommentCheck: Don't remove the token placed immediately after the namespace closing brace. llvm-svn: 234403 --- diff --git a/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp b/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp index 69f456b..ba3b837 100644 --- a/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp @@ -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; diff --git a/clang-tools-extra/test/clang-tidy/google-readability-namespace-comments.cpp b/clang-tools-extra/test/clang-tidy/google-readability-namespace-comments.cpp index 0a50b49..0815edc 100644 --- a/clang-tools-extra/test/clang-tidy/google-readability-namespace-comments.cpp +++ b/clang-tools-extra/test/clang-tidy/google-readability-namespace-comments.cpp @@ -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