diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-03-04 12:41:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-04 12:41:34 +0100 |
commit | 06fc7d68ff816090ea8654a5a0240a4444a8eb6f (patch) | |
tree | 271a7bcd24f79f3c09bace5ee0ef9b8b918f8726 /clang/lib/AST/ByteCode/Pointer.cpp | |
parent | 25479a3c9c55af0f1651bf43b0ad5ec7d572ff34 (diff) | |
download | llvm-06fc7d68ff816090ea8654a5a0240a4444a8eb6f.zip llvm-06fc7d68ff816090ea8654a5a0240a4444a8eb6f.tar.gz llvm-06fc7d68ff816090ea8654a5a0240a4444a8eb6f.tar.bz2 |
[clang][bytecode] Don't error out on incomplete declarations (#129685)
Later operations on these are invalid, but the declaration is fine, if
extern.
Diffstat (limited to 'clang/lib/AST/ByteCode/Pointer.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Pointer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp index e587640..324097a 100644 --- a/clang/lib/AST/ByteCode/Pointer.cpp +++ b/clang/lib/AST/ByteCode/Pointer.cpp @@ -248,7 +248,12 @@ APValue Pointer::toAPValue(const ASTContext &ASTCtx) const { Index = Ptr.getIndex(); QualType ElemType = Desc->getElemQualType(); - Offset += (Index * ASTCtx.getTypeSizeInChars(ElemType)); + if (const auto *RD = ElemType->getAsRecordDecl(); + RD && !RD->getDefinition()) { + // Ignore this for the offset. + } else { + Offset += (Index * ASTCtx.getTypeSizeInChars(ElemType)); + } if (Ptr.getArray().getType()->isArrayType()) Path.push_back(APValue::LValuePathEntry::ArrayIndex(Index)); Ptr = Ptr.getArray(); |