summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Demangle/MicrosoftDemangle.cpp5
-rw-r--r--llvm/test/Demangle/invalid-manglings.test5
2 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp
index 194a152acb8..f45df9413d7 100644
--- a/llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -481,7 +481,7 @@ Demangler::demangleFunctionIdentifierCode(StringView &MangledName) {
if (MangledName.consumeFront("__"))
return demangleFunctionIdentifierCode(
MangledName, FunctionIdentifierCodeGroup::DoubleUnder);
- else if (MangledName.consumeFront("_"))
+ if (MangledName.consumeFront("_"))
return demangleFunctionIdentifierCode(MangledName,
FunctionIdentifierCodeGroup::Under);
return demangleFunctionIdentifierCode(MangledName,
@@ -1575,7 +1575,8 @@ FuncClass Demangler::demangleFunctionClass(StringView &MangledName) {
FuncClass VFlag = FC_VirtualThisAdjust;
if (MangledName.consumeFront('R'))
VFlag = FuncClass(VFlag | FC_VirtualThisAdjustEx);
-
+ if (MangledName.empty())
+ break;
switch (MangledName.popFront()) {
case '0':
return FuncClass(FC_Private | FC_Virtual | VFlag);
diff --git a/llvm/test/Demangle/invalid-manglings.test b/llvm/test/Demangle/invalid-manglings.test
index 5d6f3160a95..4c155b765a4 100644
--- a/llvm/test/Demangle/invalid-manglings.test
+++ b/llvm/test/Demangle/invalid-manglings.test
@@ -99,3 +99,8 @@
; CHECK-EMPTY:
; CHECK-NEXT: ?B@?$?K$H?
; CHECK-NEXT: error: Invalid mangled name
+
+??C@$
+; CHECK-EMPTY:
+; CHECK-NEXT: ??C@$
+; CHECK-NEXT: error: Invalid mangled name
OpenPOWER on IntegriCloud