]> granicus.if.org Git - clang/commitdiff
[Basic] PartialDiagnostic: Manual split out the cold part of freeStorage(), the
authorDaniel Dunbar <daniel@zuster.org>
Thu, 8 Mar 2012 18:43:59 +0000 (18:43 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 8 Mar 2012 18:43:59 +0000 (18:43 +0000)
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

include/clang/Basic/PartialDiagnostic.h

index f6092e685819d323b15a4ca4d1e7eef14e983606..007e6a47603ac080319694a5240c60a0d6bad455 100644 (file)
@@ -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<StorageAllocator *>(~uintptr_t(0)))