[PATCH] D116020: [clang][#52782] Bail on incomplete parameter type in stdcall name mangling
Markus Böck via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 5 08:58:43 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG782791ee84d2: [clang][#52782] Bail on incomplete parameter type in stdcall name mangling (authored by zero9178).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116020/new/
https://reviews.llvm.org/D116020
Files:
clang/lib/AST/Mangle.cpp
clang/test/CodeGen/pr52782-stdcall-func-decl.cpp
Index: clang/test/CodeGen/pr52782-stdcall-func-decl.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGen/pr52782-stdcall-func-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple i686-w64-windows-gnu -o - -emit-llvm -debug-info-kind=constructor %s | FileCheck %s
+
+enum nsresult {};
+
+class NotNull;
+
+class nsICanvasRenderingContextInternal {
+ // CHECK: !DISubprogram(name: "InitializeWithDrawTarget", linkageName: "\01__ZN33nsICanvasRenderingContextInternal24InitializeWithDrawTargetE7NotNull at 4"
+ nsresult __stdcall InitializeWithDrawTarget(NotNull);
+} nsTBaseHashSet;
Index: clang/lib/AST/Mangle.cpp
===================================================================
--- clang/lib/AST/Mangle.cpp
+++ 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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116020.397607.patch
Type: text/x-patch
Size: 1495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220105/760496ab/attachment-0001.bin>
More information about the cfe-commits
mailing list