aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CheckObjCUnusedIVars.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-09-09 15:08:12 +0000
committerMike Stump <mrs@apple.com>2009-09-09 15:08:12 +0000
commit1eb4433ac451dc16f4133a88af2d002ac26c58ef (patch)
tree07065b80cb7787bb7b9ffcb985196007a57e86f7 /lib/Analysis/CheckObjCUnusedIVars.cpp
parent79d39f92590cf2e91bf81486b02cd1156d13ca54 (diff)
Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CheckObjCUnusedIVars.cpp')
-rw-r--r--lib/Analysis/CheckObjCUnusedIVars.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Analysis/CheckObjCUnusedIVars.cpp b/lib/Analysis/CheckObjCUnusedIVars.cpp
index 75470972f3..1a900f8976 100644
--- a/lib/Analysis/CheckObjCUnusedIVars.cpp
+++ b/lib/Analysis/CheckObjCUnusedIVars.cpp
@@ -29,7 +29,7 @@ typedef llvm::DenseMap<const ObjCIvarDecl*,IVarState> IvarUsageMap;
static void Scan(IvarUsageMap& M, const Stmt* S) {
if (!S)
return;
-
+
if (const ObjCIvarRefExpr *Ex = dyn_cast<ObjCIvarRefExpr>(S)) {
const ObjCIvarDecl *D = Ex->getDecl();
IvarUsageMap::iterator I = M.find(D);
@@ -37,7 +37,7 @@ static void Scan(IvarUsageMap& M, const Stmt* S) {
I->second = Used;
return;
}
-
+
// Blocks can reference an instance variable of a class.
if (const BlockExpr *BE = dyn_cast<BlockExpr>(S)) {
Scan(M, BE->getBody());
@@ -51,12 +51,12 @@ static void Scan(IvarUsageMap& M, const Stmt* S) {
static void Scan(IvarUsageMap& M, const ObjCPropertyImplDecl* D) {
if (!D)
return;
-
+
const ObjCIvarDecl* ID = D->getPropertyIvarDecl();
if (!ID)
return;
-
+
IvarUsageMap::iterator I = M.find(ID);
if (I != M.end())
I->second = Used;
@@ -71,9 +71,9 @@ void clang::CheckObjCUnusedIvar(const ObjCImplementationDecl *D,
// Iterate over the ivars.
for (ObjCInterfaceDecl::ivar_iterator I=ID->ivar_begin(),
E=ID->ivar_end(); I!=E; ++I) {
-
+
const ObjCIvarDecl* ID = *I;
-
+
// Ignore ivars that aren't private.
if (ID->getAccessControl() != ObjCIvarDecl::Private)
continue;
@@ -81,31 +81,31 @@ void clang::CheckObjCUnusedIvar(const ObjCImplementationDecl *D,
// Skip IB Outlets.
if (ID->getAttr<IBOutletAttr>())
continue;
-
+
M[ID] = Unused;
}
if (M.empty())
return;
-
+
// Now scan the methods for accesses.
for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(),
E = D->instmeth_end(); I!=E; ++I)
Scan(M, (*I)->getBody());
-
+
// Scan for @synthesized property methods that act as setters/getters
// to an ivar.
for (ObjCImplementationDecl::propimpl_iterator I = D->propimpl_begin(),
E = D->propimpl_end(); I!=E; ++I)
- Scan(M, *I);
-
+ Scan(M, *I);
+
// Find ivars that are unused.
for (IvarUsageMap::iterator I = M.begin(), E = M.end(); I!=E; ++I)
if (I->second == Unused) {
std::string sbuf;
llvm::raw_string_ostream os(sbuf);
os << "Instance variable '" << I->first->getNameAsString()
- << "' in class '" << ID->getNameAsString()
+ << "' in class '" << ID->getNameAsString()
<< "' is never used by the methods in its @implementation "
"(although it may be used by category methods).";