try to workaround clang crash

Stack dump:
 0.	Program arguments: clang++ -stdlib=libc++ -fsanitize-blacklist=/src/libreoffice/bin/sanitize-excludelist.txt -DBOOST_SYSTEM_NO_DEPRECATED -DCPPU_ENV=gcc3 -DLINUX -DNDEBUG -DOSL_DEBUG_LEVEL=0 -DUNIX -DUNX -DX86_64 -D_PTHREADS -D_REENTRANT -DCPPU_DLLIMPLEMENTATION -fvisibility=hidden -Wall -Wno-missing-braces -Wendif-labels -Wextra -Wundef -Wunreachable-code -Wshadow -Wunused-macros -Wembedded-directive -finput-charset=UTF-8 -fmessage-length=0 -fno-common -pipe -fstack-protector-strong -Wdeprecated-copy-dtor -Wimplicit-fallthrough -Wunused-exception-parameter -Wrange-loop-analysis -fvisibility-inlines-hidden -fPIC -Wshadow -Woverloaded-virtual -std=c++20 -pthread -O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp -stdlib=libc++ -fexceptions -DLIBO_INTERNAL_ONLY -c /src/libreoffice/cppu/source/threadpool/current.cxx -o /work/workdir_for_build/CxxObject/cppu/source/threadpool/current.o -MMD -MT /work/workdir_for_build/CxxObject/cppu/source/threadpool/current.o -MP -MF /work/workdir_for_build/Dep/CxxObject/cppu/source/threadpool/current.d_ -I/src/libreoffice/include -I/work/config_build -I/work/workdir_for_build/UnoApiHeadersTarget/udkapi/normal
 1.	/src/libreoffice/cppu/source/threadpool/current.cxx:77:8: current parser token ';'
 2.	/src/libreoffice/cppu/source/threadpool/current.cxx:37:1: parsing namespace 'cppu'
 3.	/src/libreoffice/cppu/source/threadpool/current.cxx:41:1: parsing function body 'cppu::get_type_XCurrentContext'
 4.	/src/libreoffice/cppu/source/threadpool/current.cxx:41:1: in compound statement ('{}')
  #0 0x000000000190f863 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/bin/clang-15+0x190f863)
  #1 0x000000000190d7ae llvm::sys::RunSignalHandlers() (/usr/local/bin/clang-15+0x190d7ae)
  #2 0x000000000190ed0d llvm::sys::CleanupOnSignal(unsigned long) (/usr/local/bin/clang-15+0x190ed0d)
  #3 0x0000000001893000 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
  #4 0x00007f628aef1420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
  #5 0x00007f628aafc963 (/lib/x86_64-linux-gnu/libc.so.6+0x18b963)
  #6 0x000000000186b31b llvm::APInt::APInt(unsigned int, llvm::ArrayRef<unsigned long>) (/usr/local/bin/clang-15+0x186b31b)
  #7 0x0000000003d5031a (anonymous namespace)::StmtPrinter::VisitUserDefinedLiteral(clang::UserDefinedLiteral*) StmtPrinter.cpp:0:0
  #8 0x0000000003d44e40 clang::Stmt::printPretty(llvm::raw_ostream&, clang::PrinterHelper*, clang::PrintingPolicy const&, unsigned int, llvm::StringRef, clang::ASTContext const*) const (/usr/local/bin/clang-15+0x3d44e40)

Change-Id: I963a7ee431748b21ab587a90208f9cdbb2df2bf9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166918
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-04-30 10:00:22 +01:00
parent da3913a70c
commit a6f52af757

View file

@ -37,45 +37,47 @@ using namespace ::com::sun::star::uno;
namespace cppu
{
static typelib_InterfaceTypeDescription * impl_get_type_XCurrentContext()
{
OUString sTypeName(u"com.sun.star.uno.XCurrentContext"_ustr);
typelib_InterfaceTypeDescription* pTD = nullptr;
typelib_TypeDescriptionReference* pMembers[1] = { nullptr };
OUString sMethodName0(u"com.sun.star.uno.XCurrentContext::getValueByName"_ustr);
typelib_typedescriptionreference_new(&pMembers[0], typelib_TypeClass_INTERFACE_METHOD,
sMethodName0.pData);
typelib_typedescription_newInterface(
&pTD, sTypeName.pData, 0, 0, 0, 0, 0,
*typelib_static_type_getByTypeClass(typelib_TypeClass_INTERFACE), 1, pMembers);
typelib_typedescription_register(reinterpret_cast<typelib_TypeDescription**>(&pTD));
typelib_typedescriptionreference_release(pMembers[0]);
typelib_InterfaceMethodTypeDescription* pMethod = nullptr;
typelib_Parameter_Init aParameters[1];
OUString sParamName0(u"Name"_ustr);
OUString sParamType0(u"string"_ustr);
aParameters[0].pParamName = sParamName0.pData;
aParameters[0].eTypeClass = typelib_TypeClass_STRING;
aParameters[0].pTypeName = sParamType0.pData;
aParameters[0].bIn = true;
aParameters[0].bOut = false;
rtl_uString* pExceptions[1];
OUString sExceptionName0(u"com.sun.star.uno.RuntimeException"_ustr);
pExceptions[0] = sExceptionName0.pData;
OUString sReturnType0(u"any"_ustr);
typelib_typedescription_newInterfaceMethod(&pMethod, 3, false, sMethodName0.pData,
typelib_TypeClass_ANY, sReturnType0.pData, 1,
aParameters, 1, pExceptions);
typelib_typedescription_register(reinterpret_cast<typelib_TypeDescription**>(&pMethod));
typelib_typedescription_release(&pMethod->aBase.aBase);
// another static ref:
++reinterpret_cast<typelib_TypeDescription*>(pTD)->nStaticRefCount;
return pTD;
}
static typelib_InterfaceTypeDescription * get_type_XCurrentContext()
{
static typelib_InterfaceTypeDescription* s_type_XCurrentContext = []() {
OUString sTypeName(u"com.sun.star.uno.XCurrentContext"_ustr);
typelib_InterfaceTypeDescription* pTD = nullptr;
typelib_TypeDescriptionReference* pMembers[1] = { nullptr };
OUString sMethodName0(u"com.sun.star.uno.XCurrentContext::getValueByName"_ustr);
typelib_typedescriptionreference_new(&pMembers[0], typelib_TypeClass_INTERFACE_METHOD,
sMethodName0.pData);
typelib_typedescription_newInterface(
&pTD, sTypeName.pData, 0, 0, 0, 0, 0,
*typelib_static_type_getByTypeClass(typelib_TypeClass_INTERFACE), 1, pMembers);
typelib_typedescription_register(reinterpret_cast<typelib_TypeDescription**>(&pTD));
typelib_typedescriptionreference_release(pMembers[0]);
typelib_InterfaceMethodTypeDescription* pMethod = nullptr;
typelib_Parameter_Init aParameters[1];
OUString sParamName0(u"Name"_ustr);
OUString sParamType0(u"string"_ustr);
aParameters[0].pParamName = sParamName0.pData;
aParameters[0].eTypeClass = typelib_TypeClass_STRING;
aParameters[0].pTypeName = sParamType0.pData;
aParameters[0].bIn = true;
aParameters[0].bOut = false;
rtl_uString* pExceptions[1];
OUString sExceptionName0(u"com.sun.star.uno.RuntimeException"_ustr);
pExceptions[0] = sExceptionName0.pData;
OUString sReturnType0(u"any"_ustr);
typelib_typedescription_newInterfaceMethod(&pMethod, 3, false, sMethodName0.pData,
typelib_TypeClass_ANY, sReturnType0.pData, 1,
aParameters, 1, pExceptions);
typelib_typedescription_register(reinterpret_cast<typelib_TypeDescription**>(&pMethod));
typelib_typedescription_release(&pMethod->aBase.aBase);
// another static ref:
++reinterpret_cast<typelib_TypeDescription*>(pTD)->nStaticRefCount;
return pTD;
}();
static typelib_InterfaceTypeDescription* s_type_XCurrentContext = impl_get_type_XCurrentContext();
return s_type_XCurrentContext;
}