[clang-tools-extra] r330559 - update test to use ivar in implementation instead of class extension
Yan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 22 17:15:15 PDT 2018
Author: wizard
Date: Sun Apr 22 17:15:15 2018
New Revision: 330559
URL: http://llvm.org/viewvc/llvm-project?rev=330559&view=rev
Log:
update test to use ivar in implementation instead of class extension
Summary: using ivar in class extension is not supported in 32-bit architecture of MacOS.
Reviewers: alexfh, hokein
Reviewed By: alexfh
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D45912
Added:
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m
Modified:
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
Modified: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp?rev=330559&r1=330558&r2=330559&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp Sun Apr 22 17:15:15 2018
@@ -109,6 +109,7 @@ namespace readability {
m(TemplateParameter) \
m(TypeAlias) \
m(MacroDefinition) \
+ m(ObjcIvar) \
enum StyleKind {
#define ENUMERATE(v) SK_ ## v,
@@ -384,6 +385,9 @@ static StyleKind findStyleKind(
const NamedDecl *D,
const std::vector<llvm::Optional<IdentifierNamingCheck::NamingStyle>>
&NamingStyles) {
+ if (isa<ObjCIvarDecl>(D) && NamingStyles[SK_ObjcIvar])
+ return SK_ObjcIvar;
+
if (isa<TypedefDecl>(D) && NamingStyles[SK_Typedef])
return SK_Typedef;
Added: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m?rev=330559&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m (added)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m Sun Apr 22 17:15:15 2018
@@ -0,0 +1,15 @@
+// RUN: %check_clang_tidy %s readability-identifier-naming %t \
+// RUN: -config='{CheckOptions: \
+// RUN: [{key: readability-identifier-naming.ObjcIvarPrefix, value: '_'}]}' \
+// RUN: --
+
+ at interface Foo
+ at end
+
+ at implementation Foo {
+ int _bar;
+ int barWithoutPrefix;
+ // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for objc ivar 'barWithoutPrefix' [readability-identifier-naming]
+ // CHECK-FIXES: int _barWithoutPrefix;
+}
+ at end
More information about the cfe-commits
mailing list