Bug 1747009 - Apply upstream clang patch to fix crash on mingw32 builds. CLOSED TREE

Differential Revision: https://phabricator.services.mozilla.com/D134480
This commit is contained in:
Mike Hommey 2021-12-22 05:30:52 +00:00
Родитель ddcb9ea385
Коммит 9178dc6cdd
2 изменённых файлов: 41 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,39 @@
Index: clang/lib/AST/Mangle.cpp
===================================================================
--- a/clang/lib/AST/Mangle.cpp
+++ b/clang/lib/AST/Mangle.cpp
@@ -225,11 +225,17 @@
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD))
if (!MD->isStatic())
++ArgWords;
- for (const auto &AT : Proto->param_types())
+ for (const auto &AT : Proto->param_types()) {
+ // If an argument type is incomplete there is no way to get its size to
+ // correctly encode into the mangling scheme.
+ // Follow GCCs behaviour by simply breaking out of the loop.
+ if (AT->isIncompleteType())
+ break;
// Size should be aligned to pointer size.
ArgWords +=
llvm::alignTo(ASTContext.getTypeSize(AT), TI.getPointerWidth(0)) /
TI.getPointerWidth(0);
+ }
Out << ((TI.getPointerWidth(0) / 8) * ArgWords);
}
Index: clang/test/CodeGen/pr52782-stdcall-func-decl.cpp
===================================================================
--- /dev/null
+++ b/clang/test/CodeGen/pr52782-stdcall-func-decl.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple i686-w64-windows-gnu -o - -emit-llvm -debug-info-kind=constructor %s
+
+#define NS_IMETHOD_(type) type __stdcall
+
+enum nsresult {};
+
+class NotNull;
+
+class nsICanvasRenderingContextInternal {
+ NS_IMETHOD_(nsresult) InitializeWithDrawTarget(NotNull);
+} nsTBaseHashSet;

Просмотреть файл

@ -19,6 +19,7 @@
"llvmorg-14-init-4465-g22ea0cea595e-v2.patch",
"llvmorg-14-init-6706-g6404f4b5af39.patch",
"llvmorg-14-init-9105-g3c47c5ca13b8.patch",
"llvmorg-14-init-11347-g93a20ecee4b6.patch"
"llvmorg-14-init-11347-g93a20ecee4b6.patch",
"D116020.patch"
]
}