[llvm] r339708 - [MS Demangler] Fix some minor formatting bugs.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 14 11:54:28 PDT 2018
Author: zturner
Date: Tue Aug 14 11:54:28 2018
New Revision: 339708
URL: http://llvm.org/viewvc/llvm-project?rev=339708&view=rev
Log:
[MS Demangler] Fix some minor formatting bugs.
1) We print __restrict twice on member pointers. This is fixed
and relevant tests are re-enabled.
2) Several tests were disabled because of printing slightly
different output than undname. These were confirmed to be
bugs in undname, so we just re-enable the tests.
3) The test for printing reference temporaries is re-enabled. This
is a clang mangling extension, so we have some flexibility with
how we demangle it. The output currently looks fine, so we just
re-enable the test with no fixes.
Modified:
llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
llvm/trunk/test/Demangle/ms-back-references.test
llvm/trunk/test/Demangle/ms-mangle.test
llvm/trunk/test/Demangle/ms-return-qualifiers.test
Modified: llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp?rev=339708&r1=339707&r2=339708&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Tue Aug 14 11:54:28 2018
@@ -815,8 +815,6 @@ void MemberPointerType::outputPre(Output
// FIXME: We should output this, but it requires updating lots of tests.
// if (Ty.Quals & Q_Pointer64)
// OS << " __ptr64";
- if (Quals & Q_Restrict)
- OS << " __restrict";
}
void MemberPointerType::outputPost(OutputStream &OS, NameResolver &Resolver) {
@@ -2028,12 +2026,12 @@ ArrayType *Demangler::demangleArrayType(
}
if (MangledName.consumeFront("$$C")) {
- if (MangledName.consumeFront("B"))
- ATy->Quals = Q_Const;
- else if (MangledName.consumeFront("C") || MangledName.consumeFront("D"))
- ATy->Quals = Qualifiers(Q_Const | Q_Volatile);
- else if (!MangledName.consumeFront("A"))
+ bool IsMember = false;
+ std::tie(ATy->Quals, IsMember) = demangleQualifiers(MangledName);
+ if (IsMember) {
Error = true;
+ return nullptr;
+ }
}
ATy->ElementType = demangleType(MangledName, QualifierMangleMode::Drop);
Modified: llvm/trunk/test/Demangle/ms-back-references.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/ms-back-references.test?rev=339708&r1=339707&r2=339708&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/ms-back-references.test (original)
+++ llvm/trunk/test/Demangle/ms-back-references.test Tue Aug 14 11:54:28 2018
@@ -23,8 +23,6 @@
?f7@@YAXHPAHH0_N1PA_N at Z
; CHECK: void __cdecl f7(int, int *, int, int *, bool, bool, bool *)
-; FIXME: tests for more than 10 types?
-
?g1@@YAXUS@@@Z
; CHECK: void __cdecl g1(struct S)
Modified: llvm/trunk/test/Demangle/ms-mangle.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/ms-mangle.test?rev=339708&r1=339707&r2=339708&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/ms-mangle.test (original)
+++ llvm/trunk/test/Demangle/ms-mangle.test Tue Aug 14 11:54:28 2018
@@ -12,9 +12,10 @@
?anonymous@?A at N@@3HA
; CHECK: int N::`anonymous namespace'::anonymous
-; FIXME: Reference Temporaries
-; ?$RT1 at NeedsReferenceTemporary@@3ABHB
-; ?$RT1 at NeedsReferenceTemporary@@3AEBHEB
+?$RT1 at NeedsReferenceTemporary@@3ABHB
+; CHECK: int const &NeedsReferenceTemporary::$RT1
+?$RT1 at NeedsReferenceTemporary@@3AEBHEB
+; CHECK: int const &NeedsReferenceTemporary::$RT1
?_c@@YAHXZ
; CHECK: int __cdecl _c(void)
@@ -181,12 +182,13 @@
?color2@@3QBNB
; CHECK: double const *const color2
-; FIXME-EXTRACONST: These tests fails because we print an extra const inside the parens.
-; ?color3@@3QAY02$$CBNA
-; FIXME-EXTRACONST: double const (*color3)[3]
-
-; ?color4@@3QAY02$$CBNA
-; FIXME-EXTRACONST: double const (*color4)[3]
+; undname prints `double const (* color3)[3]`, but this is a bug in undname.
+?color3@@3QAY02$$CBNA
+; CHECK: double const (*const color3)[3]
+
+; undname prints `double const (* color4)[3]`, but this is a bug in undname.
+?color4@@3QAY02$$CBNA
+; CHECK: double const (*const color4)[3]
?memptr1@@3RESB@@HES1@
; CHECK: int volatile B::*volatile memptr1
Modified: llvm/trunk/test/Demangle/ms-return-qualifiers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/ms-return-qualifiers.test?rev=339708&r1=339707&r2=339708&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/ms-return-qualifiers.test (original)
+++ llvm/trunk/test/Demangle/ms-return-qualifiers.test Tue Aug 14 11:54:28 2018
@@ -160,13 +160,11 @@
?f9@@YAQQS@@HXZ
; CHECK: int S::*const __cdecl f9(void)
-; We print __restrict twice here.
?f10@@YAPIQS@@HXZ
-; FIXME: int S::* __restrict __cdecl f10(void)
+; CHECK: int S::*__restrict __cdecl f10(void)
-; We print __restrict twice here.
?f11@@YAQIQS@@HXZ
-; FIXME: int S::* __restrict __cdecl f11(void)
+; CHECK: int S::*const __restrict __cdecl f11(void)
?g1@@YAP6AHH at ZXZ
; CHECK: int (__cdecl * __cdecl g1(void))(int)
More information about the llvm-commits
mailing list