diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-05-04 16:32:21 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-05-04 16:32:21 +0000 |
commit | d10099e5c8238fa0327f03921cf2e3c8975c881e (patch) | |
tree | 5a13e7a0ddc7b1c7866bbf826401161188218b45 /lib/Sema/SemaCast.cpp | |
parent | bbba25fa8e388e82e04f66784c2fc9f89b901abe (diff) |
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>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCast.cpp')
-rw-r--r-- | lib/Sema/SemaCast.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Sema/SemaCast.cpp b/lib/Sema/SemaCast.cpp index a67d1dec59..c11c30aa17 100644 --- a/lib/Sema/SemaCast.cpp +++ b/lib/Sema/SemaCast.cpp @@ -561,8 +561,8 @@ void CastOperation::CheckDynamicCast() { assert(DestPointer && "Reference to void is not possible"); } else if (DestRecord) { if (Self.RequireCompleteType(OpRange.getBegin(), DestPointee, - Self.PDiag(diag::err_bad_dynamic_cast_incomplete) - << DestRange)) + diag::err_bad_dynamic_cast_incomplete, + DestRange)) return; } else { Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class) @@ -597,8 +597,8 @@ void CastOperation::CheckDynamicCast() { const RecordType *SrcRecord = SrcPointee->getAs<RecordType>(); if (SrcRecord) { if (Self.RequireCompleteType(OpRange.getBegin(), SrcPointee, - Self.PDiag(diag::err_bad_dynamic_cast_incomplete) - << SrcExpr.get()->getSourceRange())) + diag::err_bad_dynamic_cast_incomplete, + SrcExpr.get())) return; } else { Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class) @@ -1075,8 +1075,8 @@ TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType, QualType OrigDestType, unsigned &msg, CastKind &Kind, CXXCastPath &BasePath) { // We can only work with complete types. But don't complain if it doesn't work - if (Self.RequireCompleteType(OpRange.getBegin(), SrcType, Self.PDiag(0)) || - Self.RequireCompleteType(OpRange.getBegin(), DestType, Self.PDiag(0))) + if (Self.RequireCompleteType(OpRange.getBegin(), SrcType, 0) || + Self.RequireCompleteType(OpRange.getBegin(), DestType, 0)) return TC_NotApplicable; // Downcast can only happen in class hierarchies, so we need classes. |