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--;
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--;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits