[PATCH] D154889: [MicrosoftDemangle] fix warn-trailing false positive
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 10 13:38:09 PDT 2023
nickdesaulniers created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
A follow up to commit 6bad76c7ae93 <https://reviews.llvm.org/rG6bad76c7ae93a94fbac39db08fee23ce46d97fdb> ("[Demangle] fix windows tests")
based on @nico's report.
Fixes: #63740
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154889
Files:
llvm/lib/Demangle/MicrosoftDemangle.cpp
llvm/test/Demangle/warn-trailing.test
Index: llvm/test/Demangle/warn-trailing.test
===================================================================
--- llvm/test/Demangle/warn-trailing.test
+++ llvm/test/Demangle/warn-trailing.test
@@ -4,3 +4,8 @@
; CHECK: ?x@@3HAasdf
; CHECK-NEXT: int x
; CHECK-NEXT: warning: trailing characters: asdf
+
+.?AVNet@@
+; CHECK: .?AVNet@@
+; CHECK-NEXT: class Net `RTTI Type Descriptor Name'
+; CHECK-NOT: warning: trailing characters
Index: llvm/lib/Demangle/MicrosoftDemangle.cpp
===================================================================
--- llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -2404,7 +2404,8 @@
std::string_view Name{MangledName};
SymbolNode *AST = D.parse(Name);
if (!D.Error && NMangled)
- *NMangled = Name.empty() ? 0 : &*Name.begin() - &*MangledName.begin();
+ *NMangled = Name.empty() ? MangledName.size()
+ : &*Name.begin() - &*MangledName.begin();
if (Flags & MSDF_DumpBackrefs)
D.dumpBackReferences();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154889.538807.patch
Type: text/x-patch
Size: 1028 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230710/dbb72446/attachment.bin>
More information about the llvm-commits
mailing list