Cleanup, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86351 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 0616fca..df7be10 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -384,6 +384,12 @@
   return IdResolver.isDeclInScope(D, Ctx, Context, S);
 }
 
+static bool ShouldDiagnoseUnusedDecl(const NamedDecl *D) {
+  return (!D->isUsed() && !D->hasAttr<UnusedAttr>() && isa<VarDecl>(D) && 
+          !isa<ParmVarDecl>(D) && !isa<ImplicitParamDecl>(D) && 
+          D->getDeclContext()->isFunctionOrMethod());
+}
+
 void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) {
   if (S->decl_empty()) return;
   assert((S->getFlags() & (Scope::DeclScope | Scope::TemplateParamScope)) &&
@@ -400,10 +406,8 @@
     if (!D->getDeclName()) continue;
 
     // Diagnose unused variables in this scope.
-    if (!D->isUsed() && !D->hasAttr<UnusedAttr>() && isa<VarDecl>(D) && 
-        !isa<ParmVarDecl>(D) && !isa<ImplicitParamDecl>(D) && 
-        D->getDeclContext()->isFunctionOrMethod())
-	    Diag(D->getLocation(), diag::warn_unused_variable) << D->getDeclName();
+    if (ShouldDiagnoseUnusedDecl(D))
+      Diag(D->getLocation(), diag::warn_unused_variable) << D->getDeclName();
     
     // Remove this name from our lexical scope.
     IdResolver.RemoveDecl(D);