[clang] [Clang] Introduce __builtin_is_modifiable_lvalue() (PR #132524)
Andrew Pinski via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 22 01:39:39 PDT 2025
================
@@ -12985,6 +12985,16 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
assert(Src.isInt());
return Success((Src.getInt() & (Alignment - 1)) == 0 ? 1 : 0, E);
}
+ case Builtin::BI__builtin_is_modifiable_lvalue: {
+ const Expr *Arg = E->getArg(0);
+ SpeculativeEvaluationRAII SpeculativeEval(Info);
+ IgnoreSideEffectsRAII Fold(Info);
+
+ SourceLocation OrigLoc = Arg->getExprLoc();
+ bool IsLValue = Arg->IgnoreCasts()->isModifiableLvalue(
----------------
pinskia wrote:
I suspect `IgnoreCasts()` should be removed here. Otherwise `(int)var` would be allowed. As we talked about on mastodon. The GCC implemention does not ignore casts.
https://github.com/llvm/llvm-project/pull/132524
More information about the cfe-commits
mailing list