[clang] [clang-tools-extra] [CLANGD] Do not crash on designator initialization of union (PR #83369)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 28 19:11: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 267beb10f2812107734a1cd2172b46e928af76b7 3d6afe011221ac239bb668b375ed3f6c356fc47d -- clang/lib/AST/Expr.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 33eeeda89f..4104fad181 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -4604,18 +4604,17 @@ SourceLocation DesignatedInitExpr::getBeginLoc() const {
if (First.isFieldDesignator()) {
/* search all designators in case the first one is not
initialized */
- for (unsigned int i=0; i<DIE->size(); i++) {
+ for (unsigned int i = 0; i < DIE->size(); i++) {
Designator &Des = *DIE->getDesignator(i);
SourceLocation retval = GNUSyntax ? Des.getFieldLoc() : Des.getDotLoc();
- if (!retval.isValid ())
- continue;
+ if (!retval.isValid())
+ continue;
return retval;
}
}
return First.getLBracketLoc();
}
-
SourceLocation DesignatedInitExpr::getEndLoc() const {
return getInit()->getEndLoc();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/83369
More information about the cfe-commits
mailing list