diff options
author | Akira Hatanaka <ahatanak@gmail.com> | 2025-08-25 10:17:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-25 10:17:43 -0700 |
commit | e612f37f2c110987ec43f8aa4fe8e86d6f64186f (patch) | |
tree | 0660b15e58d2646eb271eb87a764acd8acd56289 /clang/lib/CodeGen/CGExprConstant.cpp | |
parent | a61ff1487b6696b9ab3bb7d9c2c1ea899eb7a4f0 (diff) | |
download | llvm-e612f37f2c110987ec43f8aa4fe8e86d6f64186f.zip llvm-e612f37f2c110987ec43f8aa4fe8e86d6f64186f.tar.gz llvm-e612f37f2c110987ec43f8aa4fe8e86d6f64186f.tar.bz2 |
[PAC] Fix codegen for polymorphic class variables with consteval constructors (#154858)
Fix a bug in CodeGen where such variables could cause a compilation
error or be emitted with an undef initializer when the vtable was signed
with address discrimination.
rdar://155696134
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index a96c151..3c1bdf9 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -876,8 +876,9 @@ bool ConstStructBuilder::Build(const APValue &Val, const RecordDecl *RD, for (const BaseInfo &Base : Bases) { bool IsPrimaryBase = Layout.getPrimaryBase() == Base.Decl; - Build(Val.getStructBase(Base.Index), Base.Decl, IsPrimaryBase, - VTableClass, Offset + Base.Offset); + if (!Build(Val.getStructBase(Base.Index), Base.Decl, IsPrimaryBase, + VTableClass, Offset + Base.Offset)) + return false; } } @@ -1627,7 +1628,7 @@ llvm::Constant *ConstantEmitter::tryEmitConstantExpr(const ConstantExpr *CE) { if (CE->isGLValue()) RetType = CGM.getContext().getLValueReferenceType(RetType); - return emitAbstract(CE->getBeginLoc(), CE->getAPValueResult(), RetType); + return tryEmitAbstract(CE->getAPValueResult(), RetType); } llvm::Constant * |