stephanemoore updated this revision to Diff 135510.
stephanemoore added a comment.
Revert the inclusion of the link to the Google Objective-C style guide in the
diagnostic message.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D43581
Files:
clang-tidy/google/GlobalVariableDeclarationCheck.cpp
test/clang-tidy/google-objc-global-variable-declaration.m
Index: test/clang-tidy/google-objc-global-variable-declaration.m
===================================================================
--- test/clang-tidy/google-objc-global-variable-declaration.m
+++ test/clang-tidy/google-objc-global-variable-declaration.m
@@ -30,8 +30,16 @@
// CHECK-FIXES: static NSString* const k_Alpha = @"SecondNotAlpha";
static NSString* const kGood = @"hello";
+static NSString* const XYGood = @"hello";
static NSString* gMyIntGood = 0;
+extern NSString* const GTLServiceErrorDomain;
+
+typedef NS_ENUM(NSInteger, GTLServiceError) {
+ GTLServiceErrorQueryResultMissing = -3000,
+ GTLServiceErrorWaitTimedOut = -3001,
+};
+
@implementation Foo
- (void)f {
int x = 0;
Index: clang-tidy/google/GlobalVariableDeclarationCheck.cpp
===================================================================
--- clang-tidy/google/GlobalVariableDeclarationCheck.cpp
+++ clang-tidy/google/GlobalVariableDeclarationCheck.cpp
@@ -72,7 +72,7 @@
this);
Finder->addMatcher(varDecl(hasGlobalStorage(), hasType(isConstQualified()),
unless(isLocalVariable()),
- unless(matchesName("::k[A-Z]")))
+ unless(matchesName("::(k[A-Z]|[A-Z]{2,})")))
.bind("global_const"),
this);
}
@@ -88,7 +88,7 @@
if (const auto *Decl = Result.Nodes.getNodeAs<VarDecl>("global_const")) {
diag(Decl->getLocation(),
"const global variable '%0' must have a name which starts with "
- "'k[A-Z]'")
+ "an appropriate prefix matching '(k[A-Z]|[A-Z]{2,})'.")
<< Decl->getName() << generateFixItHint(Decl, true);
}
}
Index: test/clang-tidy/google-objc-global-variable-declaration.m
===================================================================
--- test/clang-tidy/google-objc-global-variable-declaration.m
+++ test/clang-tidy/google-objc-global-variable-declaration.m
@@ -30,8 +30,16 @@
// CHECK-FIXES: static NSString* const k_Alpha = @"SecondNotAlpha";
static NSString* const kGood = @"hello";
+static NSString* const XYGood = @"hello";
static NSString* gMyIntGood = 0;
+extern NSString* const GTLServiceErrorDomain;
+
+typedef NS_ENUM(NSInteger, GTLServiceError) {
+ GTLServiceErrorQueryResultMissing = -3000,
+ GTLServiceErrorWaitTimedOut = -3001,
+};
+
@implementation Foo
- (void)f {
int x = 0;
Index: clang-tidy/google/GlobalVariableDeclarationCheck.cpp
===================================================================
--- clang-tidy/google/GlobalVariableDeclarationCheck.cpp
+++ clang-tidy/google/GlobalVariableDeclarationCheck.cpp
@@ -72,7 +72,7 @@
this);
Finder->addMatcher(varDecl(hasGlobalStorage(), hasType(isConstQualified()),
unless(isLocalVariable()),
- unless(matchesName("::k[A-Z]")))
+ unless(matchesName("::(k[A-Z]|[A-Z]{2,})")))
.bind("global_const"),
this);
}
@@ -88,7 +88,7 @@
if (const auto *Decl = Result.Nodes.getNodeAs<VarDecl>("global_const")) {
diag(Decl->getLocation(),
"const global variable '%0' must have a name which starts with "
- "'k[A-Z]'")
+ "an appropriate prefix matching '(k[A-Z]|[A-Z]{2,})'.")
<< Decl->getName() << generateFixItHint(Decl, true);
}
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits