[PATCH] D148852: [Demangle] fix windows tests
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 16:41:30 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6bad76c7ae93: [Demangle] fix windows tests (authored by nickdesaulniers).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148852/new/
https://reviews.llvm.org/D148852
Files:
llvm/lib/Demangle/MicrosoftDemangle.cpp
Index: llvm/lib/Demangle/MicrosoftDemangle.cpp
===================================================================
--- llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -793,6 +793,7 @@
return nullptr;
}
const char *Start = &*MangledName.begin();
+ const size_t StartSize = MangledName.size();
MangledName.remove_prefix(MD5Last + 1);
// There are two additional special cases for MD5 names:
@@ -807,7 +808,9 @@
// either.
consumeFront(MangledName, "??_R4@");
- std::string_view MD5(Start, &*MangledName.begin() - Start);
+ assert(MangledName.size() < StartSize);
+ const size_t Count = StartSize - MangledName.size();
+ std::string_view MD5(Start, Count);
SymbolNode *S = Arena.alloc<SymbolNode>(NodeKind::Md5Symbol);
S->Name = synthesizeQualifiedName(Arena, MD5);
@@ -2402,7 +2405,7 @@
std::string_view Name{MangledName};
SymbolNode *AST = D.parse(Name);
if (!D.Error && NMangled)
- *NMangled = &*Name.begin() - MangledName;
+ *NMangled = Name.empty() ? 0 : &*Name.begin() - MangledName;
if (Flags & MSDF_DumpBackrefs)
D.dumpBackReferences();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148852.515528.patch
Type: text/x-patch
Size: 1149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230420/59755a93/attachment.bin>
More information about the llvm-commits
mailing list