https://github.com/alanzhao1 closed
https://github.com/llvm/llvm-project/pull/76976
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/alanzhao1 updated
https://github.com/llvm/llvm-project/pull/76976
>From 1ac47a1548f0dbd21747ef05c64fc2f08668e0e1 Mon Sep 17 00:00:00 2001
From: Alan Zhao
Date: Wed, 3 Jan 2024 12:29:21 -0800
Subject: [PATCH] [clang] Fix parenthesized list initialization of arrays not
https://github.com/efriedma-quic approved this pull request.
LGTM
The logic in CGExprCXX.cpp is a bit more complicated than I'd like, but I don't
see any obvious way to simplify it.
https://github.com/llvm/llvm-project/pull/76976
___
cfe-commits
@@ -1038,11 +1038,14 @@ void CodeGenFunction::EmitNewArrayInitializer(
return true;
};
+ const InitListExpr *ILE = dyn_cast(Init);
+ const CXXParenListInitExpr *CPLIE = dyn_cast(Init);
+ const StringLiteral *SL = dyn_cast(Init);
// If the initializer is an
https://github.com/alanzhao1 updated
https://github.com/llvm/llvm-project/pull/76976
>From ee4e3c8634bb876166ee753a4ebcbf3c1699a175 Mon Sep 17 00:00:00 2001
From: Alan Zhao
Date: Wed, 3 Jan 2024 12:29:21 -0800
Subject: [PATCH 1/9] [clang] Fix parenthesized list initialization of arrays
not
https://github.com/alanzhao1 updated
https://github.com/llvm/llvm-project/pull/76976
>From ee4e3c8634bb876166ee753a4ebcbf3c1699a175 Mon Sep 17 00:00:00 2001
From: Alan Zhao
Date: Wed, 3 Jan 2024 12:29:21 -0800
Subject: [PATCH 1/8] [clang] Fix parenthesized list initialization of arrays
not
https://github.com/MitalAshok edited
https://github.com/llvm/llvm-project/pull/76976
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1561,16 +1577,21 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const
CXXNewExpr *E) {
// 1. Build a call to the allocation function.
FunctionDecl *allocator = E->getOperatorNew();
- // If there is a brace-initializer, cannot allocate fewer elements than
inits.
+
@@ -1073,7 +1075,7 @@ void CodeGenFunction::EmitNewArrayInitializer(
return;
}
-InitListElements = ILE->getNumInits();
+InitListElements = ILE ? ILE->getNumInits() : CPLIE->getInitExprs().size();
MitalAshok wrote:
```suggestion
ArrayRef
cor3ntin wrote:
@MitalAshok You want to review this?
https://github.com/llvm/llvm-project/pull/76976
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/alanzhao1 updated
https://github.com/llvm/llvm-project/pull/76976
>From ee4e3c8634bb876166ee753a4ebcbf3c1699a175 Mon Sep 17 00:00:00 2001
From: Alan Zhao
Date: Wed, 3 Jan 2024 12:29:21 -0800
Subject: [PATCH 1/7] [clang] Fix parenthesized list initialization of arrays
not
https://github.com/alanzhao1 edited
https://github.com/llvm/llvm-project/pull/76976
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1038,11 +1038,14 @@ void CodeGenFunction::EmitNewArrayInitializer(
return true;
};
+ const InitListExpr *ILE = dyn_cast(Init);
+ const CXXParenListInitExpr *CPLIE = dyn_cast(Init);
+ const StringLiteral *SL = dyn_cast(Init);
// If the initializer is an
@@ -1038,11 +1038,14 @@ void CodeGenFunction::EmitNewArrayInitializer(
return true;
};
+ const InitListExpr *ILE = dyn_cast(Init);
+ const CXXParenListInitExpr *CPLIE = dyn_cast(Init);
+ const StringLiteral *SL = dyn_cast(Init);
// If the initializer is an
@@ -1038,11 +1038,14 @@ void CodeGenFunction::EmitNewArrayInitializer(
return true;
};
+ const InitListExpr *ILE = dyn_cast(Init);
+ const CXXParenListInitExpr *CPLIE = dyn_cast(Init);
+ const StringLiteral *SL = dyn_cast(Init);
// If the initializer is an
alanzhao1 wrote:
Ping. Any more comments?
https://github.com/llvm/llvm-project/pull/76976
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1038,11 +1038,14 @@ void CodeGenFunction::EmitNewArrayInitializer(
return true;
};
+ const InitListExpr *ILE = dyn_cast(Init);
+ const CXXParenListInitExpr *CPLIE = dyn_cast(Init);
+ const StringLiteral *SL = dyn_cast(Init);
// If the initializer is an
@@ -5495,14 +5495,12 @@ static void TryOrBuildParenListInitialization(
return;
}
// ...and value-initialized for each k < i <= n;
-if (ArrayLength > Args.size()) {
alanzhao1 wrote:
> What is this change supposed to do?
https://github.com/alanzhao1 updated
https://github.com/llvm/llvm-project/pull/76976
>From ee4e3c8634bb876166ee753a4ebcbf3c1699a175 Mon Sep 17 00:00:00 2001
From: Alan Zhao
Date: Wed, 3 Jan 2024 12:29:21 -0800
Subject: [PATCH 1/6] [clang] Fix parenthesized list initialization of arrays
not
@@ -1038,11 +1038,14 @@ void CodeGenFunction::EmitNewArrayInitializer(
return true;
};
+ const InitListExpr *ILE = dyn_cast(Init);
+ const CXXParenListInitExpr *CPLIE = dyn_cast(Init);
+ const StringLiteral *SL = dyn_cast(Init);
// If the initializer is an
@@ -5495,14 +5495,12 @@ static void TryOrBuildParenListInitialization(
return;
}
// ...and value-initialized for each k < i <= n;
-if (ArrayLength > Args.size()) {
efriedma-quic wrote:
What is this change supposed to do?
The existing
https://github.com/alanzhao1 updated
https://github.com/llvm/llvm-project/pull/76976
>From ee4e3c8634bb876166ee753a4ebcbf3c1699a175 Mon Sep 17 00:00:00 2001
From: Alan Zhao
Date: Wed, 3 Jan 2024 12:29:21 -0800
Subject: [PATCH 1/5] [clang] Fix parenthesized list initialization of arrays
not
alanzhao1 wrote:
> Have you considered the following case?
>
> ```
> void foo() {
> char* arr = new char[]("asdf");
> }
> ```
Thanks for catching this - this causes this patch to crash. Working on this
right now.
https://github.com/llvm/llvm-project/pull/76976
efriedma-quic wrote:
Have you considered the following case?
```
void foo() {
char* arr = new char[]("asdf");
}
```
https://github.com/llvm/llvm-project/pull/76976
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/alanzhao1 updated
https://github.com/llvm/llvm-project/pull/76976
>From ee4e3c8634bb876166ee753a4ebcbf3c1699a175 Mon Sep 17 00:00:00 2001
From: Alan Zhao
Date: Wed, 3 Jan 2024 12:29:21 -0800
Subject: [PATCH 1/4] [clang] Fix parenthesized list initialization of arrays
not
@@ -1073,7 +1075,7 @@ void CodeGenFunction::EmitNewArrayInitializer(
return;
}
-InitListElements = ILE->getNumInits();
+InitListElements = ILE ? ILE->getNumInits() : CPLIE->getInitExprs().size();
cor3ntin wrote:
This is not great, but I
@@ -1101,7 +1103,8 @@ void CodeGenFunction::EmitNewArrayInitializer(
}
CharUnits StartAlign = CurPtr.getAlignment();
-for (unsigned i = 0, e = ILE->getNumInits(); i != e; ++i) {
+ArrayRef InitExprs = ILE ? ILE->inits() : CPLIE->getInitExprs();
+for
https://github.com/cor3ntin commented:
Sema changes look okay.
I'd like @erichkeane to look at the codegen tests
https://github.com/llvm/llvm-project/pull/76976
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/cor3ntin edited
https://github.com/llvm/llvm-project/pull/76976
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/alanzhao1 updated
https://github.com/llvm/llvm-project/pull/76976
>From ee4e3c8634bb876166ee753a4ebcbf3c1699a175 Mon Sep 17 00:00:00 2001
From: Alan Zhao
Date: Wed, 3 Jan 2024 12:29:21 -0800
Subject: [PATCH 1/3] [clang] Fix parenthesized list initialization of arrays
not
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff a7a78fd427569a7ad8a27e682a66fe414f004a35
ee4e3c8634bb876166ee753a4ebcbf3c1699a175 --
https://github.com/alanzhao1 updated
https://github.com/llvm/llvm-project/pull/76976
>From ee4e3c8634bb876166ee753a4ebcbf3c1699a175 Mon Sep 17 00:00:00 2001
From: Alan Zhao
Date: Wed, 3 Jan 2024 12:29:21 -0800
Subject: [PATCH 1/2] [clang] Fix parenthesized list initialization of arrays
not
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Alan Zhao (alanzhao1)
Changes
This bug is caused by parenthesized list initialization not being implemented
in `CodeGenFunction::EmitNewArrayInitializer(...)`.
Parenthesized list initialization of `struct`s with `operator new` already
https://github.com/alanzhao1 created
https://github.com/llvm/llvm-project/pull/76976
This bug is caused by parenthesized list initialization not being implemented
in `CodeGenFunction::EmitNewArrayInitializer(...)`.
Parenthesized list initialization of `struct`s with `operator new` already
34 matches
Mail list logo