[libcxx-commits] [libcxxabi] 75db179 - [demangler] Add co_await demangling
Nathan Sidwell via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 1 04:49:37 PST 2022
Author: Nathan Sidwell
Date: 2022-03-01T04:49:19-08:00
New Revision: 75db1795e44629b9c84c70410f6a6b106c4c5f3a
URL: https://github.com/llvm/llvm-project/commit/75db1795e44629b9c84c70410f6a6b106c4c5f3a
DIFF: https://github.com/llvm/llvm-project/commit/75db1795e44629b9c84c70410f6a6b106c4c5f3a.diff
LOG: [demangler] Add co_await demangling
The demangler doesn't understand 'aw' as an operator name. This adds
the necessary smarts -- you may use this as an operator functionname,
but not as an expression operator.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D120143
Added:
Modified:
libcxxabi/src/demangle/ItaniumDemangle.h
libcxxabi/test/test_demangle.pass.cpp
llvm/include/llvm/Demangle/ItaniumDemangle.h
Removed:
################################################################################
diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h
index d14376ac8473b..a3693b524f96c 100644
--- a/libcxxabi/src/demangle/ItaniumDemangle.h
+++ b/libcxxabi/src/demangle/ItaniumDemangle.h
@@ -2568,6 +2568,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
Call, // Function call: expr (expr*)
CCast, // C cast: (type)expr
Conditional, // Conditional: expr ? expr : expr
+ NameOnly, // Overload only, not allowed in expression.
// Below do not have operator names
NamedCast, // Named cast, @<type>(expr)
OfIdOp, // alignof, sizeof, typeid
@@ -2877,6 +2878,7 @@ AbstractManglingParser<Derived, Alloc>::parseOperatorEncoding() {
{"ad", OperatorInfo::Prefix, false, "operator&"},
{"an", OperatorInfo::Binary, false, "operator&"},
{"at", OperatorInfo::OfIdOp, /*Type*/ true, "alignof ("},
+ {"aw", OperatorInfo::NameOnly, false, "operator co_await"},
{"az", OperatorInfo::OfIdOp, /*Type*/ false, "alignof ("},
{"cc", OperatorInfo::NamedCast, false, "const_cast"},
{"cl", OperatorInfo::Call, false, "operator()"},
@@ -4573,6 +4575,10 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() {
return nullptr;
return make<EnclosingExpr>(Sym, Arg, ")");
}
+ case OperatorInfo::NameOnly: {
+ // Not valid as an expression operand.
+ return nullptr;
+ }
}
DEMANGLE_UNREACHABLE;
}
diff --git a/libcxxabi/test/test_demangle.pass.cpp b/libcxxabi/test/test_demangle.pass.cpp
index 2f438143fbf16..9ad692973a00f 100644
--- a/libcxxabi/test/test_demangle.pass.cpp
+++ b/libcxxabi/test/test_demangle.pass.cpp
@@ -29865,6 +29865,8 @@ const char* cases[][2] =
{"_ZN2FnIXdlLj4EEXgsdaLj4EEEEvv", "void Fn<delete 4u, ::delete[] 4u>()"},
{"_Z3TPLIiET_S0_", "int TPL<int>(int)"},
+
+ {"_ZN1XawEv", "X::operator co_await()"},
};
const unsigned N = sizeof(cases) / sizeof(cases[0]);
@@ -29950,6 +29952,8 @@ const char* invalid_cases[] =
"_ZN1fIiEEvNTUt_E",
"_ZNDTUt_Ev",
+
+ "_ZN1fIXawLi0EEEEvv",
};
const unsigned NI = sizeof(invalid_cases) / sizeof(invalid_cases[0]);
diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index cf0bd6d180c95..ad5c7da544656 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -2568,6 +2568,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
Call, // Function call: expr (expr*)
CCast, // C cast: (type)expr
Conditional, // Conditional: expr ? expr : expr
+ NameOnly, // Overload only, not allowed in expression.
// Below do not have operator names
NamedCast, // Named cast, @<type>(expr)
OfIdOp, // alignof, sizeof, typeid
@@ -2877,6 +2878,7 @@ AbstractManglingParser<Derived, Alloc>::parseOperatorEncoding() {
{"ad", OperatorInfo::Prefix, false, "operator&"},
{"an", OperatorInfo::Binary, false, "operator&"},
{"at", OperatorInfo::OfIdOp, /*Type*/ true, "alignof ("},
+ {"aw", OperatorInfo::NameOnly, false, "operator co_await"},
{"az", OperatorInfo::OfIdOp, /*Type*/ false, "alignof ("},
{"cc", OperatorInfo::NamedCast, false, "const_cast"},
{"cl", OperatorInfo::Call, false, "operator()"},
@@ -4573,6 +4575,10 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() {
return nullptr;
return make<EnclosingExpr>(Sym, Arg, ")");
}
+ case OperatorInfo::NameOnly: {
+ // Not valid as an expression operand.
+ return nullptr;
+ }
}
DEMANGLE_UNREACHABLE;
}
More information about the libcxx-commits
mailing list