From: Daniel Dunbar Date: Thu, 8 Mar 2012 18:43:59 +0000 (+0000) Subject: [Basic] PartialDiagnostic: Manual split out the cold part of freeStorage(), the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=54e1c41b31c0bc5acad4473f802215bcd6a3206b;p=clang [Basic] PartialDiagnostic: Manual split out the cold part of freeStorage(), the hot path will typically profitably get inlined (based on what I see from the users of PartialDiagnostic). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152322 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index f6092e6858..007e6a4760 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -141,6 +141,16 @@ private: if (!DiagStorage) return; + // The hot path for PartialDiagnostic is when we just used it to wrap an ID + // (typically so we have the flexibility of passing a more complex + // diagnostic into the callee, but that does not commonly occur). + // + // Split this out into a slow function for silly compilers (*cough*) which + // can't do decent partial inlining. + freeStorageSlow(); + } + + void freeStorageSlow() { if (Allocator) Allocator->Deallocate(DiagStorage); else if (Allocator != reinterpret_cast(~uintptr_t(0)))