diff options
Diffstat (limited to 'clang/lib/AST/Interp/Pointer.cpp')
| -rw-r--r-- | clang/lib/AST/Interp/Pointer.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/clang/lib/AST/Interp/Pointer.cpp b/clang/lib/AST/Interp/Pointer.cpp index 85857d4ee1c8..d77cd8943c49 100644 --- a/clang/lib/AST/Interp/Pointer.cpp +++ b/clang/lib/AST/Interp/Pointer.cpp @@ -243,8 +243,17 @@ bool Pointer::isInitialized() const { return IM->second->isElementInitialized(getIndex()); } + if (asBlockPointer().Base == 0) + return true; + + if (isRoot() && PointeeStorage.BS.Base == sizeof(GlobalInlineDescriptor)) { + const GlobalInlineDescriptor &GD = + *reinterpret_cast<const GlobalInlineDescriptor *>(block()->rawData()); + return GD.InitState == GlobalInitState::Initialized; + } + // Field has its bit in an inline descriptor. - return PointeeStorage.BS.Base == 0 || getInlineDesc()->IsInitialized; + return getInlineDesc()->IsInitialized; } void Pointer::initialize() const { @@ -282,6 +291,13 @@ void Pointer::initialize() const { return; } + if (isRoot() && PointeeStorage.BS.Base == sizeof(GlobalInlineDescriptor)) { + GlobalInlineDescriptor &GD = *reinterpret_cast<GlobalInlineDescriptor *>( + asBlockPointer().Pointee->rawData()); + GD.InitState = GlobalInitState::Initialized; + return; + } + // Field has its bit in an inline descriptor. assert(PointeeStorage.BS.Base != 0 && "Only composite fields can be initialised"); @@ -292,6 +308,10 @@ void Pointer::activate() const { // Field has its bit in an inline descriptor. assert(PointeeStorage.BS.Base != 0 && "Only composite fields can be initialised"); + + if (isRoot() && PointeeStorage.BS.Base == sizeof(GlobalInlineDescriptor)) + return; + getInlineDesc()->IsActive = true; } |
