-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[OpenACC] Ensure ArrayRef and SmallVector are kept in sync. #163273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
My OpenACCReductionRecipeWithStorage attempted to get its allocations in sync with the ArrayRef so I could use the arrayref to refer to the allocation. Unfortunately I'd forgotten about the move constructor, which made it get out of sync, which Asan caught.
@llvm/pr-subscribers-clang Author: Erich Keane (erichkeane) ChangesMy OpenACCReductionRecipeWithStorage attempted to get its allocations in sync with the ArrayRef so I could use the arrayref to refer to the allocation. Unfortunately I'd forgotten about the move constructor, Full diff: https://github.com/llvm/llvm-project/pull/163273.diff 1 Files Affected:
diff --git a/clang/include/clang/AST/OpenACCClause.h b/clang/include/clang/AST/OpenACCClause.h
index 379495c658825..1e351f31f4b92 100644
--- a/clang/include/clang/AST/OpenACCClause.h
+++ b/clang/include/clang/AST/OpenACCClause.h
@@ -1311,13 +1311,37 @@ struct OpenACCReductionRecipe {
// the OpenACCReductionClause node has been created. This one has storage for
// the CombinerRecipe, since Trailing storage for it doesn't exist yet.
struct OpenACCReductionRecipeWithStorage : OpenACCReductionRecipe {
+private:
llvm::SmallVector<CombinerRecipe, 1> CombinerRecipeStorage;
+public:
OpenACCReductionRecipeWithStorage(VarDecl *A,
llvm::ArrayRef<CombinerRecipe> Combiners)
: OpenACCReductionRecipe(A, {}), CombinerRecipeStorage(Combiners) {
CombinerRecipes = CombinerRecipeStorage;
}
+
+ OpenACCReductionRecipeWithStorage(
+ const OpenACCReductionRecipeWithStorage &Other)
+ : OpenACCReductionRecipe(Other),
+ CombinerRecipeStorage(Other.CombinerRecipeStorage) {
+ CombinerRecipes = CombinerRecipeStorage;
+ }
+
+ OpenACCReductionRecipeWithStorage(OpenACCReductionRecipeWithStorage &&Other)
+ : OpenACCReductionRecipe(std::move(Other)),
+ CombinerRecipeStorage(std::move(Other.CombinerRecipeStorage)) {
+ CombinerRecipes = CombinerRecipeStorage;
+ }
+
+ // There is no real problem implementing these, we just have to make sure the
+ // array-ref this inherits from stays in sync. But as we don't need it at the
+ // moment, make sure we don't accidentially call these.
+ OpenACCReductionRecipeWithStorage &
+ operator=(OpenACCReductionRecipeWithStorage &&) = delete;
+ OpenACCReductionRecipeWithStorage &
+ operator=(const OpenACCReductionRecipeWithStorage &) = delete;
+
static OpenACCReductionRecipeWithStorage Empty() {
return OpenACCReductionRecipeWithStorage(/*AllocaDecl=*/nullptr, {});
}
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/17456 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/23954 Here is the relevant piece of the build log for the reference
|
My OpenACCReductionRecipeWithStorage attempted to get its allocations in sync with the ArrayRef so I could use the arrayref to refer to the allocation. Unfortunately I'd forgotten about the move constructor,
which made it get out of sync, which Asan caught.