[clang] Use cast_or_null instead of cast (PR #93749)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Wed May 29 19:18:46 PDT 2024
================
@@ -2408,9 +2408,11 @@ Expr *VarDecl::getInit() {
return cast<Expr>(S);
auto *Eval = getEvaluatedStmt();
- return cast<Expr>(Eval->Value.isOffset()
- ? Eval->Value.get(getASTContext().getExternalSource())
- : Eval->Value.get(nullptr));
+
+ return cast_or_null<Expr>(
----------------
zyn0217 wrote:
nit: Prefer `cast_if_present`.
https://github.com/llvm/llvm-project/pull/93749
More information about the cfe-commits
mailing list