[PATCH] D87099: fix symbol printing on windows

Jameson Nash via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 08:40:41 PDT 2020


vtjnash updated this revision to Diff 293469.
vtjnash added a comment.

rename helper functions to canBeUnquotedInDirective


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87099/new/

https://reviews.llvm.org/D87099

Files:
  llvm/lib/IR/Mangler.cpp


Index: llvm/lib/IR/Mangler.cpp
===================================================================
--- llvm/lib/IR/Mangler.cpp
+++ llvm/lib/IR/Mangler.cpp
@@ -185,19 +185,19 @@
 }
 
 // Check if the name needs quotes to be safe for the linker to interpret.
-static bool isAcceptableChar(char C) {
+static bool canBeUnquotedInDirective(char C) {
   return (C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z') ||
          (C >= '0' && C <= '9') || C == '_' || C == '$' || C == '.' || C == '@';
 }
 
-static bool isValidUnquotedName(StringRef Name) {
+static bool canBeUnquotedInDirective(StringRef Name) {
   if (Name.empty())
     return false;
 
   // If any of the characters in the string is an unacceptable character, force
   // quotes.
   for (char C : Name) {
-    if (!isAcceptableChar(C))
+    if (!canBeUnquotedInDirective(C))
       return false;
   }
 
@@ -214,7 +214,7 @@
   else
     OS << " -export:";
 
-  bool NeedQuotes = GV->hasName() && !isValidUnquotedName(GV->getName());
+  bool NeedQuotes = GV->hasName() && !canBeUnquotedInDirective(GV->getName());
   if (NeedQuotes)
     OS << "\"";
   if (TT.isWindowsGNUEnvironment() || TT.isWindowsCygwinEnvironment()) {
@@ -246,7 +246,7 @@
     return;
 
   OS << " /INCLUDE:";
-  bool NeedQuotes = GV->hasName() && !isValidUnquotedName(GV->getName());
+  bool NeedQuotes = GV->hasName() && !canBeUnquotedInDirective(GV->getName());
   if (NeedQuotes)
     OS << "\"";
   M.getNameWithPrefix(OS, GV, false);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87099.293469.patch
Type: text/x-patch
Size: 1468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200922/f88982de/attachment.bin>


More information about the llvm-commits mailing list