[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.

llvm-svn: 339708
This commit is contained in:
Zachary Turner 2018-08-14 18:54:28 +00:00
parent a0fd9c3e9a
commit 2bbb23ba3b
4 changed files with 17 additions and 21 deletions

View File

@ -815,8 +815,6 @@ void MemberPointerType::outputPre(OutputStream &OS, NameResolver &Resolver) {
// 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(StringView &MangledName) {
}
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);

View File

@ -23,8 +23,6 @@
?f7@@YAXHPAHH0_N1PA_N@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)

View File

@ -12,9 +12,10 @@
?anonymous@?A@N@@3HA
; CHECK: int N::`anonymous namespace'::anonymous
; FIXME: Reference Temporaries
; ?$RT1@NeedsReferenceTemporary@@3ABHB
; ?$RT1@NeedsReferenceTemporary@@3AEBHEB
?$RT1@NeedsReferenceTemporary@@3ABHB
; CHECK: int const &NeedsReferenceTemporary::$RT1
?$RT1@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]
; undname prints `double const (* color3)[3]`, but this is a bug in undname.
?color3@@3QAY02$$CBNA
; CHECK: double const (*const color3)[3]
; ?color4@@3QAY02$$CBNA
; FIXME-EXTRACONST: double const (*color4)[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

View File

@ -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@ZXZ
; CHECK: int (__cdecl * __cdecl g1(void))(int)