[libcxxabi] [llvm] [libc++abi] Avoid raw calls to assert() in libc++abi (PR #71121)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 15:24:37 PDT 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 66152f4eed4d5d380e199a75f861d9ea4c1d296e 1e87a563dbda70697b22d778a8e5a34fff4837f5 -- libcxxabi/src/cxa_demangle.cpp libcxxabi/src/demangle/DemangleConfig.h libcxxabi/src/demangle/ItaniumDemangle.h libcxxabi/src/demangle/Utility.h libcxxabi/src/fallback_malloc.cpp llvm/include/llvm/Demangle/DemangleConfig.h llvm/include/llvm/Demangle/ItaniumDemangle.h llvm/include/llvm/Demangle/Utility.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h
index 30f3ecf85874..0ebfc0ecb74d 100644
--- a/libcxxabi/src/demangle/ItaniumDemangle.h
+++ b/libcxxabi/src/demangle/ItaniumDemangle.h
@@ -2610,7 +2610,8 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
       Parser->TemplateParams.push_back(&Params);
     }
     ~ScopedTemplateParamList() {
-      DEMANGLE_ASSERT(Parser->TemplateParams.size() >= OldNumTemplateParamLists, "");
+      DEMANGLE_ASSERT(Parser->TemplateParams.size() >= OldNumTemplateParamLists,
+                      "");
       Parser->TemplateParams.shrinkToSize(OldNumTemplateParamLists);
     }
     TemplateParamList *params() { return &Params; }
@@ -2859,7 +2860,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
       std::string_view Res = Name;
       if (Kind < Unnameable) {
         DEMANGLE_ASSERT(starts_with(Res, "operator"),
-               "operator name does not start with 'operator'");
+                        "operator name does not start with 'operator'");
         Res.remove_prefix(sizeof("operator") - 1);
         if (starts_with(Res, ' '))
           Res.remove_prefix(1);
@@ -5634,7 +5635,8 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParam() {
     Node *ForwardRef = make<ForwardTemplateReference>(Index);
     if (!ForwardRef)
       return nullptr;
-    DEMANGLE_ASSERT(ForwardRef->getKind() == Node::KForwardTemplateReference, "");
+    DEMANGLE_ASSERT(ForwardRef->getKind() == Node::KForwardTemplateReference,
+                    "");
     ForwardTemplateRefs.push_back(
         static_cast<ForwardTemplateReference *>(ForwardRef));
     return ForwardRef;
diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index 4b2e18ec7163..f587e9d1dd51 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -2610,7 +2610,8 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
       Parser->TemplateParams.push_back(&Params);
     }
     ~ScopedTemplateParamList() {
-      DEMANGLE_ASSERT(Parser->TemplateParams.size() >= OldNumTemplateParamLists, "");
+      DEMANGLE_ASSERT(Parser->TemplateParams.size() >= OldNumTemplateParamLists,
+                      "");
       Parser->TemplateParams.shrinkToSize(OldNumTemplateParamLists);
     }
     TemplateParamList *params() { return &Params; }
@@ -2859,7 +2860,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
       std::string_view Res = Name;
       if (Kind < Unnameable) {
         DEMANGLE_ASSERT(starts_with(Res, "operator"),
-               "operator name does not start with 'operator'");
+                        "operator name does not start with 'operator'");
         Res.remove_prefix(sizeof("operator") - 1);
         if (starts_with(Res, ' '))
           Res.remove_prefix(1);
@@ -5634,7 +5635,8 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParam() {
     Node *ForwardRef = make<ForwardTemplateReference>(Index);
     if (!ForwardRef)
       return nullptr;
-    DEMANGLE_ASSERT(ForwardRef->getKind() == Node::KForwardTemplateReference, "");
+    DEMANGLE_ASSERT(ForwardRef->getKind() == Node::KForwardTemplateReference,
+                    "");
     ForwardTemplateRefs.push_back(
         static_cast<ForwardTemplateReference *>(ForwardRef));
     return ForwardRef;

``````````

</details>


https://github.com/llvm/llvm-project/pull/71121


More information about the llvm-commits mailing list