================
@@ -241,7 +242,21 @@ CapabilityExpr SExprBuilder::translateAttrExpr(const Expr 
*AttrExp,
   return CapabilityExpr(E, AttrExp->getType(), Neg);
 }
 
-til::LiteralPtr *SExprBuilder::createVariable(const VarDecl *VD) {
+til::SExpr *SExprBuilder::translateVarDecl(const VarDecl *VD,
+                                           CallingContext *Ctx) {
+  assert(VD);
+  // Substitute local pointer variables with their initializers if they are
+  // explicitly const or never reassigned.
+  QualType Ty = VD->getType();
+  if (Ty->isPointerType() && VD->hasInit() && !isVariableReassigned(VD)) {
----------------
aaronpuchert wrote:

I wonder if we wouldn't fare better if we lazily expand variables. This would 
keep expressions smaller, which means less memory, faster comparison and better 
comparison results in case of mismatches.

As for how, I'm not sure. `Variable` looks right, but I haven't yet wrapped my 
head around this. Usage in `SExprBuilder::addStatement` and `maybeUpdateVD` 
(currently themselves unused) look like that.

It's evident that the TIL was at some point designed to be much more powerful, 
but this work was never finished.

https://github.com/llvm/llvm-project/pull/142955
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to