Use partial diagnostics properly in call to RequireCompleteType. Among other things, this means we get a note on the declaration of the incomplete type when it is used in an exception specification.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84099 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp
index 261bebf..12d06b4 100644
--- a/lib/Sema/SemaExceptionSpec.cpp
+++ b/lib/Sema/SemaExceptionSpec.cpp
@@ -41,11 +41,9 @@
 
   // C++ 15.4p2: A type denoted in an exception-specification shall not denote
   //   an incomplete type.
-  // FIXME: This isn't right. This will supress diagnostics from template
-  // instantiation and then simply emit the invalid type diagnostic.
-  if (RequireCompleteType(Range.getBegin(), T, 0))
-    return Diag(Range.getBegin(), diag::err_incomplete_in_exception_spec)
-      << Range << T << /*direct*/0;
+  if (RequireCompleteType(Range.getBegin(), T,
+      PDiag(diag::err_incomplete_in_exception_spec) << /*direct*/0 << Range))
+    return true;
 
   // C++ 15.4p2: A type denoted in an exception-specification shall not denote
   //   an incomplete type a pointer or reference to an incomplete type, other
@@ -60,9 +58,9 @@
   } else
     return false;
 
-  if (!T->isVoidType() && RequireCompleteType(Range.getBegin(), T, 0))
-    return Diag(Range.getBegin(), diag::err_incomplete_in_exception_spec)
-      << Range << T << /*indirect*/kind;
+  if (!T->isVoidType() && RequireCompleteType(Range.getBegin(), T,
+      PDiag(diag::err_incomplete_in_exception_spec) << /*direct*/kind << Range))
+    return true;
 
   return false;
 }