[cfe-commits] r117521 - in /cfe/trunk: lib/Checker/ObjCUnusedIVarsChecker.cpp test/Analysis/unused-ivars.m
Ted Kremenek
kremenek at apple.com
Wed Oct 27 19:16:22 PDT 2010
Author: kremenek
Date: Wed Oct 27 21:16:22 2010
New Revision: 117521
URL: http://llvm.org/viewvc/llvm-project?rev=117521&view=rev
Log:
Don't warn about unamed bitfield ivars in the ObjCUnusedIvarsChecker. Fixes <rdar://problem/8481311>.
Modified:
cfe/trunk/lib/Checker/ObjCUnusedIVarsChecker.cpp
cfe/trunk/test/Analysis/unused-ivars.m
Modified: cfe/trunk/lib/Checker/ObjCUnusedIVarsChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/ObjCUnusedIVarsChecker.cpp?rev=117521&r1=117520&r2=117521&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/ObjCUnusedIVarsChecker.cpp (original)
+++ cfe/trunk/lib/Checker/ObjCUnusedIVarsChecker.cpp Wed Oct 27 21:16:22 2010
@@ -113,9 +113,11 @@
// (a) aren't private
// (b) explicitly marked unused
// (c) are iboutlets
+ // (d) are unnamed bitfields
if (ID->getAccessControl() != ObjCIvarDecl::Private ||
ID->getAttr<UnusedAttr>() || ID->getAttr<IBOutletAttr>() ||
- ID->getAttr<IBOutletCollectionAttr>())
+ ID->getAttr<IBOutletCollectionAttr>() ||
+ ID->isUnnamedBitfield())
continue;
M[ID] = Unused;
Modified: cfe/trunk/test/Analysis/unused-ivars.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/unused-ivars.m?rev=117521&r1=117520&r2=117521&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/unused-ivars.m (original)
+++ cfe/trunk/test/Analysis/unused-ivars.m Wed Oct 27 21:16:22 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fblocks -analyze -analyzer-check-objc-unused-ivars %s -verify
+// RUN: %clang_cc1 -fobjc-nonfragile-abi2 -fblocks -analyze -analyzer-check-objc-unused-ivars %s -verify
//===--- BEGIN: Delta-debugging reduced headers. --------------------------===//
@@ -95,4 +95,16 @@
@implementation RDar7353683
@end
+//===----------------------------------------------------------------------===//
+// <rdar://problem/8481311> Unused bitfield ivars trigger cause weird
+// diagnostic: "Instance variable '' in classâ¦"
+//===----------------------------------------------------------------------===//
+ at interface RDar8481311 {
+ at private
+ unsigned bitfield:1; // expected-warning {{Instance variable 'bitfield' in class 'RDar8481311' is never used}}
+}
+ at end
+
+ at implementation RDar8481311
+ at end
More information about the cfe-commits
mailing list