[clang] Consider aggregate bases when checking if an InitListExpr is constant (PR #80519)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 5 16:27:28 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 820f244aa92f11292e59440c9bc5afbdec395b20 c630eee1f930c87d2c461de92271c02de220b290 -- clang/lib/AST/Expr.cpp clang/test/SemaCXX/compound-literal.cpp clang/unittests/AST/ASTExprTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/unittests/AST/ASTExprTest.cpp b/clang/unittests/AST/ASTExprTest.cpp
index 257ac9c55d..5ec6aea8ed 100644
--- a/clang/unittests/AST/ASTExprTest.cpp
+++ b/clang/unittests/AST/ASTExprTest.cpp
@@ -28,12 +28,14 @@ using clang::tooling::buildASTFromCode;
static IntegerLiteral *createIntLiteral(ASTContext &Ctx, uint32_t Value) {
const int numBits = 32;
- return IntegerLiteral::Create(Ctx, llvm::APInt(numBits, Value),
- Ctx.IntTy, {});
+ return IntegerLiteral::Create(Ctx, llvm::APInt(numBits, Value), Ctx.IntTy,
+ {});
}
-const CXXRecordDecl *getCXXRecordDeclNode(ASTUnit *AST, const std::string &Name) {
- auto Result = match(cxxRecordDecl(hasName(Name)).bind("record"), AST->getASTContext());
+const CXXRecordDecl *getCXXRecordDeclNode(ASTUnit *AST,
+ const std::string &Name) {
+ auto Result =
+ match(cxxRecordDecl(hasName(Name)).bind("record"), AST->getASTContext());
EXPECT_FALSE(Result.empty());
return Result[0].getNodeAs<CXXRecordDecl>("record");
}
@@ -89,9 +91,9 @@ TEST(ASTExpr, InitListIsConstantInitialized) {
InitListExpr *BaseInit = new (Ctx) InitListExpr(Ctx, Loc, {}, Loc);
BaseInit->setType(Ctx.getRecordType(Empty));
Expr *Exprs[3] = {
- BaseInit,
- createIntLiteral(Ctx, 13),
- createIntLiteral(Ctx, 42),
+ BaseInit,
+ createIntLiteral(Ctx, 13),
+ createIntLiteral(Ctx, 42),
};
InitListExpr *FooInit = new (Ctx) InitListExpr(Ctx, Loc, Exprs, Loc);
FooInit->setType(Ctx.getRecordType(Foo));
``````````
</details>
https://github.com/llvm/llvm-project/pull/80519
More information about the cfe-commits
mailing list