summaryrefslogtreecommitdiff
path: root/bridges/inc/msvc/amd64.hxx
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-08-02 09:02:30 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2020-09-17 00:01:21 +0200
commit8c3e6666c5ef612a20575e0ebcd5757ba21c47f8 (patch)
tree8d5e9c9368940c7b06c67f8f1875fc456c4656b6 /bridges/inc/msvc/amd64.hxx
parent52ac46d798a1787baca33cdf9e1c2fd768559522 (diff)
WIN bridges: unify exception handling
This is almost just refactoring, but with classes like type_info_ and __type_info, just following the code became tendious. I tried to come up with better names... and in the end included some minor code changes described below. This patch moves the "common" code for MSVC exception handling into msvc_shared/except.cxx. Still it contains a few small ifdefs, so it doesn't feel like clean separation, but a lot of duplicate code is dropped this way. The "major" code change for amd64 is the drop of the duplicate static RTTInfo object originally used by mscx_getRTTI and mscx_getRTTI_len, by merging of both functions into the single, new get() function to use a single std::find call. Change-Id: Ib07d40e2794cde79156be3324c80ccf21a6aa8ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102864 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'bridges/inc/msvc/amd64.hxx')
-rw-r--r--bridges/inc/msvc/amd64.hxx59
1 files changed, 59 insertions, 0 deletions
diff --git a/bridges/inc/msvc/amd64.hxx b/bridges/inc/msvc/amd64.hxx
new file mode 100644
index 000000000000..fb095446b097
--- /dev/null
+++ b/bridges/inc/msvc/amd64.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <msvc/except.hxx>
+
+#pragma pack(push, 8)
+
+struct ExceptionType final
+{
+ sal_Int32 _n0; // flags
+ sal_uInt32 _pTypeInfo; // typeinfo
+ sal_Int32 _n1, _n2, _n3; // thiscast
+ sal_Int32 _n4; // object_size
+ sal_uInt32 _pCopyCtor; // copyctor
+ ExceptionTypeInfo exc_type_info;
+
+ explicit ExceptionType(unsigned char* pCode, sal_uInt64 pCodeBase,
+ typelib_TypeDescription* pTD) throw();
+
+ ExceptionType(const ExceptionType&) = delete;
+ ExceptionType& operator=(const ExceptionType&) = delete;
+};
+
+struct RaiseInfo final
+{
+ sal_Int32 _n0;
+ sal_uInt32 _pDtor;
+ sal_Int32 _n2;
+ sal_uInt32 _types;
+
+ // Additional fields
+ typelib_TypeDescription* _pTD;
+ unsigned char* _code;
+ sal_uInt64 _codeBase;
+
+ explicit RaiseInfo(typelib_TypeDescription* pTD) throw();
+};
+
+#pragma pack(pop)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */