2020#include " StringViewExtras.h"
2121#include " Utility.h"
2222#include < algorithm>
23- #include < cassert>
2423#include < cctype>
2524#include < cstdio>
2625#include < cstdlib>
@@ -128,12 +127,12 @@ template <class T, size_t N> class PODSmallVector {
128127
129128 // NOLINTNEXTLINE(readability-identifier-naming)
130129 void pop_back () {
131- assert (Last != First && " Popping empty vector!" );
130+ DEMANGLE_ASSERT (Last != First, " Popping empty vector!" );
132131 --Last;
133132 }
134133
135134 void shrinkToSize (size_t Index) {
136- assert (Index <= size () && " shrinkToSize() can't expand!" );
135+ DEMANGLE_ASSERT (Index <= size (), " shrinkToSize() can't expand!" );
137136 Last = First + Index;
138137 }
139138
@@ -143,11 +142,11 @@ template <class T, size_t N> class PODSmallVector {
143142 bool empty () const { return First == Last; }
144143 size_t size () const { return static_cast <size_t >(Last - First); }
145144 T &back () {
146- assert (Last != First && " Calling back() on empty vector!" );
145+ DEMANGLE_ASSERT (Last != First, " Calling back() on empty vector!" );
147146 return *(Last - 1 );
148147 }
149148 T &operator [](size_t Index) {
150- assert (Index < size () && " Invalid access!" );
149+ DEMANGLE_ASSERT (Index < size (), " Invalid access!" );
151150 return *(begin () + Index);
152151 }
153152 void clear () { Last = First; }
@@ -1677,7 +1676,7 @@ class SpecialSubstitution final : public ExpandedSpecialSubstitution {
16771676 std::string_view SV = ExpandedSpecialSubstitution::getBaseName ();
16781677 if (isInstantiation ()) {
16791678 // The instantiations are typedefs that drop the "basic_" prefix.
1680- assert (starts_with (SV, " basic_" ));
1679+ DEMANGLE_ASSERT (starts_with (SV, " basic_" ), " " );
16811680 SV.remove_prefix (sizeof (" basic_" ) - 1 );
16821681 }
16831682 return SV;
@@ -2568,7 +2567,7 @@ void Node::visit(Fn F) const {
25682567 return F (static_cast <const X *>(this ));
25692568#include " ItaniumNodes.def"
25702569 }
2571- assert ( 0 && " unknown mangling node kind" );
2570+ DEMANGLE_ASSERT ( 0 , " unknown mangling node kind" );
25722571}
25732572
25742573// / Determine the kind of a node from its type.
@@ -2610,7 +2609,8 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
26102609 Parser->TemplateParams .push_back (&Params);
26112610 }
26122611 ~ScopedTemplateParamList () {
2613- assert (Parser->TemplateParams .size () >= OldNumTemplateParamLists);
2612+ DEMANGLE_ASSERT (Parser->TemplateParams .size () >= OldNumTemplateParamLists,
2613+ " " );
26142614 Parser->TemplateParams .shrinkToSize (OldNumTemplateParamLists);
26152615 }
26162616 TemplateParamList *params () { return &Params; }
@@ -2691,7 +2691,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
26912691 }
26922692
26932693 NodeArray popTrailingNodeArray (size_t FromPosition) {
2694- assert (FromPosition <= Names.size ());
2694+ DEMANGLE_ASSERT (FromPosition <= Names.size (), " " );
26952695 NodeArray res =
26962696 makeNodeArray (Names.begin () + (long )FromPosition, Names.end ());
26972697 Names.shrinkToSize (FromPosition);
@@ -2858,8 +2858,8 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
28582858 std::string_view getSymbol () const {
28592859 std::string_view Res = Name;
28602860 if (Kind < Unnameable) {
2861- assert (starts_with (Res, " operator" ) &&
2862- " operator name does not start with 'operator'" );
2861+ DEMANGLE_ASSERT (starts_with (Res, " operator" ),
2862+ " operator name does not start with 'operator'" );
28632863 Res.remove_prefix (sizeof (" operator" ) - 1 );
28642864 if (starts_with (Res, ' ' ))
28652865 Res.remove_prefix (1 );
@@ -3693,7 +3693,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseUnresolvedName(bool Global) {
36933693 }
36943694 }
36953695
3696- assert (SoFar != nullptr );
3696+ DEMANGLE_ASSERT (SoFar != nullptr , " " );
36973697
36983698 Node *Base = getDerived ().parseBaseUnresolvedName ();
36993699 if (Base == nullptr )
@@ -5634,7 +5634,8 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParam() {
56345634 Node *ForwardRef = make<ForwardTemplateReference>(Index);
56355635 if (!ForwardRef)
56365636 return nullptr ;
5637- assert (ForwardRef->getKind () == Node::KForwardTemplateReference);
5637+ DEMANGLE_ASSERT (ForwardRef->getKind () == Node::KForwardTemplateReference,
5638+ " " );
56385639 ForwardTemplateRefs.push_back (
56395640 static_cast <ForwardTemplateReference *>(ForwardRef));
56405641 return ForwardRef;
0 commit comments