From bf8f50f6eb28ec6a8806032d06a0412c75aca170 Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Tue, 16 Jun 2020 08:06:12 -0400 Subject: [PATCH] [Reflection] NFC: Workaround LLVM C++ standard library weirdness Pull request #32244 introduced the use of `std::stringstream` but that causes vtables to be generated and we don't want that. --- include/swift/Reflection/ReflectionContext.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/swift/Reflection/ReflectionContext.h b/include/swift/Reflection/ReflectionContext.h index 82c39157df7e6..059149eaa26e2 100644 --- a/include/swift/Reflection/ReflectionContext.h +++ b/include/swift/Reflection/ReflectionContext.h @@ -34,7 +34,6 @@ #include "swift/Runtime/Unreachable.h" #include -#include #include #include #include @@ -946,10 +945,12 @@ class ReflectionContext reinterpret_cast *>( HeaderBytes.get()); if (HeaderPtr == nullptr) { - std::stringstream stream; - stream << "unable to read Next pointer 0x" << std::hex - << BacktraceListNext.getAddressData(); - return stream.str(); + // FIXME: std::stringstream would be better, but LLVM's standard library + // introduces a vtable and we don't want that. + char result[128]; + std::snprintf(result, sizeof(result), "unable to read Next pointer %p", + BacktraceListNext.getAddressData()); + return std::string(result); } auto BacktraceAddrPtr = BacktraceListNext +