[llvm] r360352 - [llvm-cxxfilt] Fix -Wshadow warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 08:58:17 PDT 2019


Author: rksimon
Date: Thu May  9 08:58:16 2019
New Revision: 360352

URL: http://llvm.org/viewvc/llvm-project?rev=360352&view=rev
Log:
[llvm-cxxfilt] Fix -Wshadow warning. NFCI.

Local variable Decorated was shadowing the global variable Decorated

Modified:
    llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp

Modified: llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp?rev=360352&r1=360351&r2=360352&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp (original)
+++ llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp Thu May  9 08:58:16 2019
@@ -55,22 +55,23 @@ Decorated(cl::Positional, cl::desc("<man
 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);




More information about the llvm-commits mailing list