[PATCH] D110986: [llvm-cxxfilt] Replace isalnum with isAlnum from StringExtras

Tomasz Miąsko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 1 23:01:32 PDT 2021


tmiasko created this revision.
tmiasko added a reviewer: dblaikie.
Herald added a reviewer: jhenderson.
Herald added a subscriber: pengfei.
tmiasko requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

D104366 <https://reviews.llvm.org/D104366> introduced a new llvm-cxxfilt test with non-ASCII characters,
which caused a failure on llvm-clang-x86_64-expensive-checks-win
builder, with a stack trace suggesting issue in a call to isalnum.

The argument to isalnum should be either EOF or a value that is
representable in the type unsigned char. The llvm-cxxfilt does not
perform a cast from char to unsigned char before the call, so the
value might be out of valid range.

Replace the call to isalnum with isAlnum from StringExtras, which takes
a char as the argument. This also makes the check independent of the
current locale.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110986

Files:
  llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp


Index: llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
===================================================================
--- llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
+++ llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
@@ -128,7 +128,7 @@
 static bool IsLegalItaniumChar(char C) {
   // Itanium CXX ABI [External Names]p5.1.1:
   // '$' and '.' in mangled names are reserved for private implementations.
-  return isalnum(C) || C == '.' || C == '$' || C == '_';
+  return isAlnum(C) || C == '.' || C == '$' || C == '_';
 }
 
 // If 'Split' is true, then 'Mangled' is broken into individual words and each


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110986.376674.patch
Type: text/x-patch
Size: 592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211002/2941c691/attachment.bin>


More information about the llvm-commits mailing list