[clang] [Clang] [AST] Fix placeholder return type name mangling for MSVC 1920+ / VS2019+ (PR #102848)
NAKAMURA Takumi via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 15 00:25:03 PDT 2024
================
@@ -2900,17 +2958,51 @@ void MicrosoftCXXNameMangler::mangleFunctionType(const FunctionType *T,
// can differ by their calling convention and are typically deduced. So
// we make sure that this type gets mangled properly.
mangleType(ResultType, Range, QMM_Result);
- } else if (const auto *AT = dyn_cast_or_null<AutoType>(
- ResultType->getContainedAutoType())) {
- Out << '?';
- mangleQualifiers(ResultType.getLocalQualifiers(), /*IsMember=*/false);
- Out << '?';
+ } else if (IsInLambda) {
+ if (const auto *AT = ResultType->getContainedAutoType()) {
+ assert(AT->getKeyword() == AutoTypeKeyword::Auto &&
+ "should only need to mangle auto!");
+ Out << '?';
+ mangleQualifiers(ResultType.getLocalQualifiers(), /*IsMember=*/false);
+ Out << '?';
+ mangleSourceName("<auto>");
+ Out << '@';
+ } else {
+ Out << '@';
+ }
+ } else if (const auto *AT = ResultType->getContainedAutoType()) {
assert(AT->getKeyword() != AutoTypeKeyword::GNUAutoType &&
"shouldn't need to mangle __auto_type!");
- mangleSourceName(AT->isDecltypeAuto() ? "<decltype-auto>" : "<auto>");
- Out << '@';
- } else if (IsInLambda) {
- Out << '@';
+
+ // If we have any pointer types with the clang address space extension
+ // then defer to the custom clang mangling to keep backwards
+ // compatibility. See `mangleType(const PointerType *T, Qualifiers Quals,
+ // SourceRange Range)` for details.
+ auto UseClangMangling = [](QualType ResultType) {
+ QualType T = ResultType;
+ while (const auto *PT = dyn_cast<PointerType>(T.getTypePtr())) {
----------------
chapuni wrote:
PT is not used.
https://github.com/llvm/llvm-project/pull/102848
More information about the cfe-commits
mailing list