summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--absl/debugging/internal/demangle.cc10
-rw-r--r--absl/debugging/internal/demangle_test.cc14
2 files changed, 22 insertions, 2 deletions
diff --git a/absl/debugging/internal/demangle.cc b/absl/debugging/internal/demangle.cc
index 42c10bbe..8b76ce01 100644
--- a/absl/debugging/internal/demangle.cc
+++ b/absl/debugging/internal/demangle.cc
@@ -14,8 +14,6 @@
// For reference check out:
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling
-//
-// Note that we only have partial C++11 support yet.
#include "absl/debugging/internal/demangle.h"
@@ -1044,6 +1042,7 @@ static bool ParseIdentifier(State *state, size_t length) {
// <operator-name> ::= nw, and other two letters cases
// ::= cv <type> # (cast)
+// ::= li <source-name> # C++11 user-defined literal
// ::= v <digit> <source-name> # vendor extended operator
static bool ParseOperatorName(State *state, int *arity) {
ComplexityGuard guard(state);
@@ -1063,6 +1062,13 @@ static bool ParseOperatorName(State *state, int *arity) {
}
state->parse_state = copy;
+ // Then user-defined literals.
+ if (ParseTwoCharToken(state, "li") && MaybeAppend(state, "operator\"\" ") &&
+ ParseSourceName(state)) {
+ return true;
+ }
+ state->parse_state = copy;
+
// Then vendor extended operators.
if (ParseOneCharToken(state, 'v') && ParseDigit(state, arity) &&
ParseSourceName(state)) {
diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc
index 68ab8a3c..108642a8 100644
--- a/absl/debugging/internal/demangle_test.cc
+++ b/absl/debugging/internal/demangle_test.cc
@@ -1035,6 +1035,20 @@ TEST(Demangle, SizeofPackInvolvingAnAliasTemplate) {
EXPECT_STREQ("f<>()", tmp);
}
+TEST(Demangle, UserDefinedLiteral) {
+ char tmp[80];
+
+ // Source:
+ //
+ // unsigned long long operator""_lit(unsigned long long x) { return x; }
+ //
+ // LLVM demangling:
+ //
+ // operator"" _lit(unsigned long long)
+ EXPECT_TRUE(Demangle("_Zli4_lity", tmp, sizeof(tmp)));
+ EXPECT_STREQ("operator\"\" _lit()", tmp);
+}
+
TEST(Demangle, Spaceship) {
char tmp[80];