void added inline comments.
================ Comment at: clang/lib/Analysis/UninitializedValues.cpp:819-820 + // semantic analysis passes. + while (isa<UnaryOperator>(Ex)) + Ex = stripCasts(C, dyn_cast<UnaryOperator>(Ex)->getSubExpr()); + ---------------- nickdesaulniers wrote: > Q: are there any unary operators that are not casts? For example isn't > something like `-x` a unary negation operator? I worry that this could be an > infinite loop as written. > > If this fear is unfounded, then I think the code could be rewritten as: > > ``` > while (const auto *UO = dyn_cast<UnaryOperator>(Ex)) > Ex = stripCasts(C, UO->getSubExpr()); > ``` It's not just casts that I want to remove. In particular, the `&` and `*` operators need to be removed to get to the variable. It *should* eventually get to a variable or non-unary expression once it goes through all of the unary operators and casts. Note there are other sema checks that determine if the expression is a proper l-value, so I can throw away the unary-ops. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114848/new/ https://reviews.llvm.org/D114848 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits