[PATCH] D54055: CXXNameMangler::mangleFunctionParam: fix assertion
JF Bastien via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 2 15:50:49 PDT 2018
jfb created this revision.
jfb added a reviewer: rjmccall.
Herald added subscribers: cfe-commits, dexonsmith.
jfb added a comment.
I'm not sure this is the right fix because mangling confuses me. It fixes the assertion I'm encountering in my patch, and I don't think I can create a repro without the patch (since I'm asking to mangle a local in a way we don't seem to right now).
The assertion seemed to be trying to avoid subtracting from zero, but was missing a case. I have a patch which was trying to mangle a local (to promote to a global and keep a nice name to it), and it was triggering the assertion.
Repository:
rC Clang
https://reviews.llvm.org/D54055
Files:
lib/AST/ItaniumMangle.cpp
Index: lib/AST/ItaniumMangle.cpp
===================================================================
--- lib/AST/ItaniumMangle.cpp
+++ lib/AST/ItaniumMangle.cpp
@@ -4300,7 +4300,9 @@
// Compute 'L'.
// parmDepth does not include the declaring function prototype.
// FunctionTypeDepth does account for that.
- assert(parmDepth < FunctionTypeDepth.getDepth());
+ assert(parmDepth < FunctionTypeDepth.getDepth() ||
+ (parmDepth == FunctionTypeDepth.getDepth() &&
+ !FunctionTypeDepth.isInResultType()));
unsigned nestingDepth = FunctionTypeDepth.getDepth() - parmDepth;
if (FunctionTypeDepth.isInResultType())
nestingDepth--;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54055.172452.patch
Type: text/x-patch
Size: 662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181102/c8eab5de/attachment.bin>
More information about the cfe-commits
mailing list