1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

llvm-undname: Yet more coverage for error paths

- For error returns in demangleSpecialTableNode(),
  demangleLocalStaticGuard(), RTTITypeDescriptor,
  demangleRttiBaseClassDescriptorNode(), demangleUnsigned(),
  demangleUntypedVariable() (via RttiBaseClassArray)

- For ?_A and ?_P which are handled at early levels of the
  demangler but are not implemented in a later stage; this
  is now more obvious

- Replace a "default:" with an explicit list of cases, to
  get -Wswitch check we list all cases

llvm-svn: 362520
This commit is contained in:
Nico Weber 2019-06-04 16:25:28 +00:00
parent 04d3999acb
commit ff504b766f
2 changed files with 53 additions and 3 deletions

View File

@ -429,10 +429,10 @@ FunctionSymbolNode *Demangler::demangleInitFiniStub(StringView &MangledName,
SymbolNode *Demangler::demangleSpecialIntrinsic(StringView &MangledName) {
SpecialIntrinsicKind SIK = consumeSpecialIntrinsicKind(MangledName);
if (SIK == SpecialIntrinsicKind::None)
return nullptr;
switch (SIK) {
case SpecialIntrinsicKind::None:
return nullptr;
case SpecialIntrinsicKind::StringLiteralSymbol:
return demangleStringLiteral(MangledName);
case SpecialIntrinsicKind::Vftable:
@ -468,8 +468,13 @@ SymbolNode *Demangler::demangleSpecialIntrinsic(StringView &MangledName) {
return demangleInitFiniStub(MangledName, false);
case SpecialIntrinsicKind::DynamicAtexitDestructor:
return demangleInitFiniStub(MangledName, true);
default:
case SpecialIntrinsicKind::Typeof:
case SpecialIntrinsicKind::UdtReturning:
// It's unclear which tools produces these manglings, so demangling
// support is not (yet?) implemented.
break;
case SpecialIntrinsicKind::Unknown:
DEMANGLE_UNREACHABLE; // Never returned by consumeSpecialIntrinsicKind.
}
Error = true;
return nullptr;

View File

@ -309,3 +309,48 @@
; CHECK-EMPTY:
; CHECK-NEXT: ?foo@?0?
; CHECK-NEXT: error: Invalid mangled name
??_Sfoo@@1Abar@@
; CHECK-EMPTY:
; CHECK-NEXT: ??_Sfoo@@1Abar@@
; CHECK-NEXT: error: Invalid mangled name
??_Bfoo@@1
; CHECK-EMPTY:
; CHECK-NEXT: ??_Bfoo@@1
; CHECK-NEXT: error: Invalid mangled name
??_R0
; CHECK-EMPTY:
; CHECK-NEXT: ??_R0
; CHECK-NEXT: error: Invalid mangled name
??_R0H
; CHECK-EMPTY:
; CHECK-NEXT: ??_R0H
; CHECK-NEXT: error: Invalid mangled name
??_R0H@8foo
; CHECK-EMPTY:
; CHECK-NEXT: ??_R0H@8foo
; CHECK-NEXT: error: Invalid mangled name
??_R1012?3foo@@
; CHECK-EMPTY:
; CHECK-NEXT: ??_R1012?3foo@@
; CHECK-NEXT: error: Invalid mangled name
??_R2foo@@1
; CHECK-EMPTY:
; CHECK-NEXT: ??_R2foo@@1
; CHECK-NEXT: error: Invalid mangled name
??_A
; CHECK-EMPTY:
; CHECK-NEXT: ??_A
; CHECK-NEXT: error: Invalid mangled name
??_P
; CHECK-EMPTY:
; CHECK-NEXT: ??_P
; CHECK-NEXT: error: Invalid mangled name