https://github.com/bwendling created https://github.com/llvm/llvm-project/pull/111448
Ensure we have the correct RecordDecl before returning the Expr we're looking for. >From 1936cd507a38d3085fa13016fb40a9a7df35a821 Mon Sep 17 00:00:00 2001 From: Bill Wendling <mo...@google.com> Date: Mon, 7 Oct 2024 15:25:47 -0700 Subject: [PATCH] [Clang] Check that we have the correct RecordDecl Ensure we have the correct RecordDecl before returning the Expr we're looking for. --- clang/lib/CodeGen/CGExpr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 52d2f6d52abf94..451442765620f7 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1096,7 +1096,7 @@ class StructAccessBase } const Expr *VisitCastExpr(const CastExpr *E) { if (E->getCastKind() == CK_LValueToRValue) - return E; + return IsExpectedRecordDecl(E) ? E : nullptr; return Visit(E->getSubExpr()); } const Expr *VisitParenExpr(const ParenExpr *E) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits