[llvm] r362514 - llvm-undname: More no-op changes to increase test coverage
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 4 08:38:00 PDT 2019
Author: nico
Date: Tue Jun 4 08:38:00 2019
New Revision: 362514
URL: http://llvm.org/viewvc/llvm-project?rev=362514&view=rev
Log:
llvm-undname: More no-op changes to increase test coverage
- Add test coverage around invalid anon namespaces and
for error paths in demanglePrimitiveType() and in
demangleFullyQualifiedTypeName()
- Use DEMANGLE_UNREACHABLE in two more unreachable places
Modified:
llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
llvm/trunk/test/Demangle/invalid-manglings.test
Modified: llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp?rev=362514&r1=362513&r2=362514&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Tue Jun 4 08:38:00 2019
@@ -238,10 +238,10 @@ demanglePointerCVQualifiers(StringView &
case 'S':
return std::make_pair(Qualifiers(Q_Const | Q_Volatile),
PointerAffinity::Pointer);
- default:
- assert(false && "Ty is not a pointer type!");
}
- return std::make_pair(Q_None, PointerAffinity::Pointer);
+ // This function is only called if isPointerType() returns true,
+ // and it only returns true for the six cases listed above.
+ DEMANGLE_UNREACHABLE;
}
StringView Demangler::copyString(StringView Borrowed) {
@@ -1694,7 +1694,7 @@ CallingConv Demangler::demangleCallingCo
}
StorageClass Demangler::demangleVariableStorageClass(StringView &MangledName) {
- assert(std::isdigit(MangledName.front()));
+ assert(MangledName.front() >= '0' && MangledName.front() <= '4');
switch (MangledName.popFront()) {
case '0':
@@ -1708,8 +1708,7 @@ StorageClass Demangler::demangleVariable
case '4':
return StorageClass::FunctionLocalStatic;
}
- Error = true;
- return StorageClass::None;
+ DEMANGLE_UNREACHABLE;
}
std::pair<Qualifiers, bool>
Modified: llvm/trunk/test/Demangle/invalid-manglings.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/invalid-manglings.test?rev=362514&r1=362513&r2=362514&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/invalid-manglings.test (original)
+++ llvm/trunk/test/Demangle/invalid-manglings.test Tue Jun 4 08:38:00 2019
@@ -249,3 +249,28 @@
; CHECK-EMPTY:
; CHECK-NEXT: ?x@@3PEAY02$$CRHEA
; CHECK-NEXT: error: Invalid mangled name
+
+?foo@@3_
+; CHECK-EMPTY:
+; CHECK-NEXT: ?foo@@3_
+; CHECK-NEXT: error: Invalid mangled name
+
+?foo@@3_XA
+; CHECK-EMPTY:
+; CHECK-NEXT: ?foo@@3_XA
+; CHECK-NEXT: error: Invalid mangled name
+
+?foo@@3Vbar
+; CHECK-EMPTY:
+; CHECK-NEXT: ?foo@@3Vbar
+; CHECK-NEXT: error: Invalid mangled name
+
+?foo@@3Vbar@
+; CHECK-EMPTY:
+; CHECK-NEXT: ?foo@@3Vbar@
+; CHECK-NEXT: error: Invalid mangled name
+
+?foo@?A
+; CHECK-EMPTY:
+; CHECK-NEXT: ?foo@?A
+; CHECK-NEXT: error: Invalid mangled name
More information about the llvm-commits
mailing list