Don't look into incomplete types when trying to warn about unused
variables. Fixes PR6948.

llvm-svn: 102436
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 3f309bb..d9696d9 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -543,6 +543,11 @@
         return false;
     }
 
+    // If we failed to complete the type for some reason, don't
+    // diagnose the variable.
+    if (Ty->isIncompleteType())
+      return false;
+
     if (const TagType *TT = Ty->getAs<TagType>()) {
       const TagDecl *Tag = TT->getDecl();
       if (Tag->hasAttr<UnusedAttr>())