[libcxx-commits] [PATCH] D93922: Mangle `__alignof__` differently than `alignof`.

John McCall via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 20 12:03:48 PST 2021

rjmccall added a reviewer: fhahn.
rjmccall added inline comments.

Comment at: clang/lib/AST/ItaniumMangle.cpp:4032
+      }
The old case doesn't seem to be adding the `u8__uuidof` prefix anymore.

Your patch description does not say anything about changing the mangling of `__uuidof`, and that should be treated separately, not just lumped in to try to make manglings more consistent.

Comment at: clang/lib/AST/ItaniumMangle.cpp:4356
+          mangleExpression(SAE->getArgumentExpr());
+          Out << 'E';
+        }
This isn't a correct mangling of `template-arg` for expressions; simple expressions should not be surrounded by `X`...`E`.  Please call `mangleTemplateArg`.

Although... `mangleTemplateArg` doesn't look like it consistently does the right thing when you pass it a `TemplateArgument` constructed with an arbitrary expression, because it seems to be relying on certain expressions having been folded to their canonical representations during template argument checking.  So really we need to have some code that mangles an expression as if it were a template argument, which is to say, recognizing simple expressions that fit into `expr-primary`.

This would break ABI for any existing place that calls `mangleTemplateArg` with an arbitrary expression, but it looks like the only place that does that is dependent matrix types, where I think wee can justify the break as a bug fix since matrix types are such a new feature.  Pinging Florian.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list