Marius =?utf-8?q?Dörner?= <[email protected]>,marius doerner
 <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>


================
@@ -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;
----------------
mariusdr wrote:

The pointer may be mutated in evaluateBuiltinObjectSize.

https://github.com/mariusdr/llvm-project/blob/0aa75255d81861952aa572d51612e5e65b906822/clang/lib/AST/ByteCode/InterpBuiltin.cpp#L2337-L2341

https://github.com/llvm/llvm-project/pull/179033
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to