[PATCH] D132918: [clang] Fix a crash in constant evaluation
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 31 01:09:44 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa5ab650714d0: [clang] Fix a crash in constant evaluation (authored by kadircet).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132918/new/
https://reviews.llvm.org/D132918
Files:
clang/lib/AST/ExprConstant.cpp
Index: clang/lib/AST/ExprConstant.cpp
===================================================================
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -4794,6 +4794,11 @@
Result = APValue((const FieldDecl *)nullptr);
return true;
}
+ // Can't access properties of an incomplete type.
+ if (!RD->hasDefinition()) {
+ Result = APValue();
+ return false;
+ }
Result = APValue(APValue::UninitStruct(), RD->getNumBases(),
std::distance(RD->field_begin(), RD->field_end()));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132918.456884.patch
Type: text/x-patch
Size: 564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220831/b7fa937c/attachment-0001.bin>
More information about the cfe-commits
mailing list