aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Pointer.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-03-04 12:41:34 +0100
committerGitHub <noreply@github.com>2025-03-04 12:41:34 +0100
commit06fc7d68ff816090ea8654a5a0240a4444a8eb6f (patch)
tree271a7bcd24f79f3c09bace5ee0ef9b8b918f8726 /clang/lib/AST/ByteCode/Pointer.cpp
parent25479a3c9c55af0f1651bf43b0ad5ec7d572ff34 (diff)
downloadllvm-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.cpp7
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();