[clang] Fix null-deref thanks to an attribute on a global declarator chunk (PR #83611)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 1 11:44:37 PST 2024
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 601a9587a1a7eb8dd6377c4ab332edd3bce97a98 8152ad56b320719553701edf020c30aea8c3213e -- clang/test/Parser/cxx-declarator-attribute-crash.cpp clang/include/clang/Sema/DeclSpec.h clang/include/clang/Sema/ParsedAttr.h clang/lib/Parse/ParseDecl.cpp clang/lib/Sema/ParsedAttr.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/ParsedAttr.cpp b/clang/lib/Sema/ParsedAttr.cpp
index 978d4e7bf4..6abc90336c 100644
--- a/clang/lib/Sema/ParsedAttr.cpp
+++ b/clang/lib/Sema/ParsedAttr.cpp
@@ -101,9 +101,9 @@ void AttributePool::takePool(AttributePool &pool) {
}
void AttributePool::takeFrom(ParsedAttributesView &List, AttributePool &Pool) {
- assert(&Pool != this && "AttributePool can't take attributes from itself");
- llvm::for_each(List.AttrList, [&Pool](ParsedAttr *A) { Pool.remove(A); });
- Attrs.insert(Attrs.end(), List.AttrList.begin(), List.AttrList.end());
+ assert(&Pool != this && "AttributePool can't take attributes from itself");
+ llvm::for_each(List.AttrList, [&Pool](ParsedAttr *A) { Pool.remove(A); });
+ Attrs.insert(Attrs.end(), List.AttrList.begin(), List.AttrList.end());
}
namespace {
``````````
</details>
https://github.com/llvm/llvm-project/pull/83611
More information about the cfe-commits
mailing list