================
@@ -2434,6 +2434,31 @@ VarDecl *VarDecl::getInitializingDeclaration() {
   return Def;
 }
 
+bool VarDecl::hasInitWithSideEffects() const {
+  if (!hasInit())
+    return false;
+
+  // Check if we can get the initializer without deserializing
+  const Expr *E = nullptr;
+  if (auto *S = dyn_cast<Stmt *>(Init)) {
+    E = cast<Expr>(S);
+  } else {
+    auto *Eval = getEvaluatedStmt();
+    if (!Eval->Value.isOffset())
+      E = cast<Expr>(Eval->Value.get(nullptr));
----------------
ChuanqiXu9 wrote:

It might be better to add comments here to explain `get` will trigger 
deserialization.

Or maybe it has better readability to add a method `noload_get` in LazyOffsetPtr

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

Reply via email to