Move Sema::RequireCompleteType() and Sema::RequireCompleteExprType()

off PartialDiagnostic. PartialDiagnostic is rather heavyweight for
something that is in the critical path and is rarely used. So, switch
over to an abstract-class-based callback mechanism that delays most of
the work until a diagnostic is actually produced. Good for ~11k code
size reduction in the compiler and 1% speedup in -fsyntax-only on the
code in <rdar://problem/11004361>.

llvm-svn: 156176
This commit is contained in:
Douglas Gregor
2012-05-04 16:32:21 +00:00
parent 5ff430ce06
commit 7bfb2d026e
18 changed files with 294 additions and 168 deletions

View File

@@ -51,7 +51,8 @@ bool Sema::CheckSpecifiedExceptionType(QualType T, const SourceRange &Range) {
// C++ 15.4p2: A type denoted in an exception-specification shall not denote
// an incomplete type.
if (RequireCompleteType(Range.getBegin(), T,
PDiag(diag::err_incomplete_in_exception_spec) << /*direct*/0 << Range))
diag::err_incomplete_in_exception_spec,
/*direct*/0, Range))
return true;
// C++ 15.4p2: A type denoted in an exception-specification shall not denote
@@ -71,8 +72,9 @@ bool Sema::CheckSpecifiedExceptionType(QualType T, const SourceRange &Range) {
if (T->isRecordType() && T->getAs<RecordType>()->isBeingDefined())
return false;
if (!T->isVoidType() && RequireCompleteType(Range.getBegin(), T,
PDiag(diag::err_incomplete_in_exception_spec) << kind << Range))
if (!T->isVoidType() &&
RequireCompleteType(Range.getBegin(), T,
diag::err_incomplete_in_exception_spec, kind, Range))
return true;
return false;