Skip to content

Commit

Permalink
[llvm-cxxfilt] Fix -Wshadow warning. NFCI.
Browse files Browse the repository at this point in the history
Local variable Decorated was shadowing the global variable Decorated

llvm-svn: 360352
  • Loading branch information
RKSimon authored and MrSidims committed May 17, 2019
1 parent 788e3b8 commit 6797c73
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,23 @@ Decorated(cl::Positional, cl::desc("<mangled>"), cl::ZeroOrMore);
static std::string demangle(llvm::raw_ostream &OS, const std::string &Mangled) {
int Status;

const char *Decorated = Mangled.c_str();
const char *DecoratedStr = Mangled.c_str();
if (StripUnderscore)
if (Decorated[0] == '_')
++Decorated;
size_t DecoratedLength = strlen(Decorated);
if (DecoratedStr[0] == '_')
++DecoratedStr;
size_t DecoratedLength = strlen(DecoratedStr);

char *Undecorated = nullptr;

if (Types || ((DecoratedLength >= 2 && strncmp(Decorated, "_Z", 2) == 0) ||
(DecoratedLength >= 4 && strncmp(Decorated, "___Z", 4) == 0)))
Undecorated = itaniumDemangle(Decorated, nullptr, nullptr, &Status);
if (Types ||
((DecoratedLength >= 2 && strncmp(DecoratedStr, "_Z", 2) == 0) ||
(DecoratedLength >= 4 && strncmp(DecoratedStr, "___Z", 4) == 0)))
Undecorated = itaniumDemangle(DecoratedStr, nullptr, nullptr, &Status);

if (!Undecorated &&
(DecoratedLength > 6 && strncmp(Decorated, "__imp_", 6) == 0)) {
(DecoratedLength > 6 && strncmp(DecoratedStr, "__imp_", 6) == 0)) {
OS << "import thunk for ";
Undecorated = itaniumDemangle(Decorated + 6, nullptr, nullptr, &Status);
Undecorated = itaniumDemangle(DecoratedStr + 6, nullptr, nullptr, &Status);
}

std::string Result(Undecorated ? Undecorated : Mangled);
Expand Down

0 comments on commit 6797c73

Please sign in to comment.