aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Pointer.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-07-29 19:30:01 +0200
committerGitHub <noreply@github.com>2025-07-29 19:30:01 +0200
commit4a44a85c89af48d74c1b54f1429dc4d78c1071d5 (patch)
treee4b5b965163dff70d44e7304404752dba038376c /clang/lib/AST/ByteCode/Pointer.cpp
parent59c3fe65054fd3fb9be62ef326d1540cc375e913 (diff)
downloadllvm-4a44a85c89af48d74c1b54f1429dc4d78c1071d5.zip
llvm-4a44a85c89af48d74c1b54f1429dc4d78c1071d5.tar.gz
llvm-4a44a85c89af48d74c1b54f1429dc4d78c1071d5.tar.bz2
[clang][bytecode] Add Pointer::initializeAllElements() (#151151)
To initialize all elements of a primitive array at once. This saves us from creating the InitMap just to destroy it again after all elements have been initialized.
Diffstat (limited to 'clang/lib/AST/ByteCode/Pointer.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Pointer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp
index 9341bc1..4753a4e1 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -495,6 +495,19 @@ void Pointer::initialize() const {
getInlineDesc()->IsInitialized = true;
}
+void Pointer::initializeAllElements() const {
+ assert(getFieldDesc()->isPrimitiveArray());
+ assert(isArrayRoot());
+
+ InitMapPtr &IM = getInitMap();
+ if (!IM) {
+ IM = std::make_pair(true, nullptr);
+ } else {
+ IM->first = true;
+ IM->second.reset();
+ }
+}
+
void Pointer::activate() const {
// Field has its bit in an inline descriptor.
assert(PointeeStorage.BS.Base != 0 &&