[llvm] e0c4ffa - [Demangle] fix windows build

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 14 16:25:24 PDT 2023


Author: Nick Desaulniers
Date: 2023-04-14T16:25:14-07:00
New Revision: e0c4ffa796b553fa78c638a9584c05ac21fe07d5

URL: https://github.com/llvm/llvm-project/commit/e0c4ffa796b553fa78c638a9584c05ac21fe07d5
DIFF: https://github.com/llvm/llvm-project/commit/e0c4ffa796b553fa78c638a9584c05ac21fe07d5.diff

LOG: [Demangle] fix windows build

Fixes diagnostics reported against
https://reviews.llvm.org/D148384

https://lab.llvm.org/buildbot/#/builders/127/builds/46749/steps/4/logs/stdio

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D148392

Added: 
    

Modified: 
    llvm/include/llvm/Demangle/Utility.h
    llvm/lib/Demangle/ItaniumDemangle.cpp
    llvm/lib/Demangle/MicrosoftDemangle.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Demangle/Utility.h b/llvm/include/llvm/Demangle/Utility.h
index bba2fd387d55..a906d238cf44 100644
--- a/llvm/include/llvm/Demangle/Utility.h
+++ b/llvm/include/llvm/Demangle/Utility.h
@@ -108,7 +108,7 @@ class OutputBuffer {
   OutputBuffer &operator+=(std::string_view R) {
     if (size_t Size = R.size()) {
       grow(Size);
-      std::memcpy(Buffer + CurrentPosition, R.begin(), Size);
+      std::memcpy(Buffer + CurrentPosition, &*R.begin(), Size);
       CurrentPosition += Size;
     }
     return *this;
@@ -125,7 +125,7 @@ class OutputBuffer {
 
     grow(Size);
     std::memmove(Buffer + Size, Buffer, CurrentPosition);
-    std::memcpy(Buffer, R.begin(), Size);
+    std::memcpy(Buffer, &*R.begin(), Size);
     CurrentPosition += Size;
 
     return *this;

diff  --git a/llvm/lib/Demangle/ItaniumDemangle.cpp b/llvm/lib/Demangle/ItaniumDemangle.cpp
index 4bc00c5144a4..7a7bcd36fc68 100644
--- a/llvm/lib/Demangle/ItaniumDemangle.cpp
+++ b/llvm/lib/Demangle/ItaniumDemangle.cpp
@@ -79,7 +79,7 @@ struct DumpVisitor {
 
   void printStr(const char *S) { fprintf(stderr, "%s", S); }
   void print(std::string_view SV) {
-    fprintf(stderr, "\"%.*s\"", (int)SV.size(), SV.begin());
+    fprintf(stderr, "\"%.*s\"", (int)SV.size(), &*SV.begin());
   }
   void print(const Node *N) {
     if (N)

diff  --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp
index 15cb0e7d8864..1885f556cd9e 100644
--- a/llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -267,7 +267,7 @@ std::string_view Demangler::copyString(std::string_view Borrowed) {
   // This is not a micro-optimization, it avoids UB, should Borrowed be an null
   // buffer.
   if (Borrowed.size())
-    std::memcpy(Stable, Borrowed.begin(), Borrowed.size());
+    std::memcpy(Stable, &*Borrowed.begin(), Borrowed.size());
 
   return {Stable, Borrowed.size()};
 }
@@ -791,7 +791,7 @@ SymbolNode *Demangler::demangleMD5Name(std::string_view &MangledName) {
     Error = true;
     return nullptr;
   }
-  const char *Start = MangledName.begin();
+  const char *Start = &*MangledName.begin();
   MangledName.remove_prefix(MD5Last + 1);
 
   // There are two additional special cases for MD5 names:
@@ -2377,7 +2377,7 @@ void Demangler::dumpBackReferences() {
     T->output(OB, OF_Default);
 
     std::string_view B = OB;
-    std::printf("  [%d] - %.*s\n", (int)I, (int)B.size(), B.begin());
+    std::printf("  [%d] - %.*s\n", (int)I, (int)B.size(), &*B.begin());
   }
   std::free(OB.getBuffer());
 
@@ -2386,7 +2386,7 @@ void Demangler::dumpBackReferences() {
   std::printf("%d name backreferences\n", (int)Backrefs.NamesCount);
   for (size_t I = 0; I < Backrefs.NamesCount; ++I) {
     std::printf("  [%d] - %.*s\n", (int)I, (int)Backrefs.Names[I]->Name.size(),
-                Backrefs.Names[I]->Name.begin());
+                &*Backrefs.Names[I]->Name.begin());
   }
   if (Backrefs.NamesCount > 0)
     std::printf("\n");
@@ -2400,7 +2400,7 @@ char *llvm::microsoftDemangle(const char *MangledName, size_t *NMangled,
   std::string_view Name{MangledName};
   SymbolNode *AST = D.parse(Name);
   if (!D.Error && NMangled)
-    *NMangled = Name.begin() - MangledName;
+    *NMangled = &*Name.begin() - MangledName;
 
   if (Flags & MSDF_DumpBackrefs)
     D.dumpBackReferences();


        


More information about the llvm-commits mailing list