@@ -28,12 +28,14 @@ NamespaceCommentCheck::NamespaceCommentCheck(StringRef Name,
28
28
llvm::Regex::IgnoreCase),
29
29
ShortNamespaceLines(Options.get(" ShortNamespaceLines" , 1U )),
30
30
SpacesBeforeComments(Options.get(" SpacesBeforeComments" , 1U )),
31
- AllowOmittingNamespaceComments(Options.get(" AllowOmittingNamespaceComments" , false )) {}
31
+ AllowOmittingNamespaceComments(
32
+ Options.get(" AllowOmittingNamespaceComments" , false )) {}
32
33
33
34
void NamespaceCommentCheck::storeOptions (ClangTidyOptions::OptionMap &Opts) {
34
35
Options.store (Opts, " ShortNamespaceLines" , ShortNamespaceLines);
35
36
Options.store (Opts, " SpacesBeforeComments" , SpacesBeforeComments);
36
- Options.store (Opts, " AllowOmittingNamespaceComments" , AllowOmittingNamespaceComments);
37
+ Options.store (Opts, " AllowOmittingNamespaceComments" ,
38
+ AllowOmittingNamespaceComments);
37
39
}
38
40
39
41
void NamespaceCommentCheck::registerMatchers (MatchFinder *Finder) {
@@ -108,7 +110,7 @@ void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) {
108
110
// Currently for nested namespace (n1::n2::...) the AST matcher will match foo
109
111
// then bar instead of a single match. So if we got a nested namespace we have
110
112
// to skip the next ones.
111
- for (const auto &EndOfNameLocation : Ends) {
113
+ for (const SourceLocation &EndOfNameLocation : Ends) {
112
114
if (Sources.isBeforeInTranslationUnit (ND->getLocation (), EndOfNameLocation))
113
115
return ;
114
116
}
@@ -142,7 +144,7 @@ void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) {
142
144
143
145
SourceRange OldCommentRange (AfterRBrace, AfterRBrace);
144
146
std::string Message = " %0 not terminated with a closing comment" ;
145
- bool hasComment = false ;
147
+ bool HasComment = false ;
146
148
147
149
// Try to find existing namespace closing comment on the same line.
148
150
if (Tok.is (tok::comment) && NextTokenIsOnSameLine) {
@@ -161,7 +163,7 @@ void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) {
161
163
return ;
162
164
}
163
165
164
- hasComment = true ;
166
+ HasComment = true ;
165
167
166
168
// Otherwise we need to fix the comment.
167
169
NeedLineBreak = Comment.starts_with (" /*" );
@@ -185,13 +187,13 @@ void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) {
185
187
}
186
188
187
189
std::string NamespaceNameForDiag =
188
- ND->isAnonymousNamespace () ? " anonymous namespace"
189
- : (" namespace '" + *NamespaceNameAsWritten + " '" );
190
+ ND->isAnonymousNamespace ()
191
+ ? " anonymous namespace"
192
+ : (" namespace '" + *NamespaceNameAsWritten + " '" );
190
193
191
194
// If no namespace comment is allowed
192
- if (!hasComment && AllowOmittingNamespaceComments) {
195
+ if (!HasComment && AllowOmittingNamespaceComments)
193
196
return ;
194
- }
195
197
196
198
std::string Fix (SpacesBeforeComments, ' ' );
197
199
Fix.append (" // namespace" );
0 commit comments