[clang] [clang][bytecode] Use in `Expr::tryEvaluateObjectSize` (PR #179033)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 31 07:09:50 PST 2026
================
@@ -327,6 +327,35 @@ bool Context::evaluateStrlen(State &Parent, const Expr *E, uint64_t &Result) {
return true;
}
+bool Context::tryEvaluateObjectSize(State &Parent, const Expr *E, unsigned Kind,
+ uint64_t &Result) {
+ assert(Stk.empty());
+ Compiler<EvalEmitter> C(*this, *P, Parent, Stk);
+
+ auto PtrRes = C.interpretAsPointer(E, [&](const Pointer &Ptr) {
+ const Descriptor *DeclDesc = Ptr.getDeclDesc();
+ assert(DeclDesc);
+ QualType T = DeclDesc->getType().getNonReferenceType();
+ if (T->isIncompleteType() || T->isFunctionType() ||
+ !T->isConstantSizeType())
+ return false;
+
+ Pointer P = Ptr;
----------------
tbaederr wrote:
Why this variable?
https://github.com/llvm/llvm-project/pull/179033
More information about the cfe-commits
mailing list