llvm-undname: Fix another crash-on-invalid
commit12041c1bc882b017093a27f44df833ba4f2f0409
authorNico Weber <nicolasweber@gmx.de>
Wed, 10 Apr 2019 17:31:34 +0000 (10 17:31 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 10 Apr 2019 17:31:34 +0000 (10 17:31 +0000)
treebd14d69b4ce7f462292df88179f95af096c07446
parentfff0af4260410cec3ea603add41cc8e039e39b26
llvm-undname: Fix another crash-on-invalid

This fixes a regression from https://reviews.llvm.org/D60354. We used to

  SymbolNode *Symbol = demangleEncodedSymbol(MangledName, QN);
  if (Symbol) {
    Symbol->Name = QN;
  }

but changed that to
  SymbolNode *Symbol = demangleEncodedSymbol(MangledName, QN);
  if (Error)
    return nullptr;
  Symbol->Name = QN;

and one branch somewhere returned a nullptr without setting Error.

Looking at the code changed in r340083 and r340710 that branch looks
like a remnant from an earlier attempt to demangle RTTI descriptors
that has since been rewritten -- so just remove this branch. It
shouldn't change behavior for correctly mangled symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358112 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Demangle/MicrosoftDemangle.cpp
test/Demangle/invalid-manglings.test