[clang] 39ac121 - [Clang] Check that we have the correct RecordDecl (#111448)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 7 15:53:03 PDT 2024
Author: Bill Wendling
Date: 2024-10-07T22:53:00Z
New Revision: 39ac121309f5c270c8fdc97c45a845542dd78681
URL: https://github.com/llvm/llvm-project/commit/39ac121309f5c270c8fdc97c45a845542dd78681
DIFF: https://github.com/llvm/llvm-project/commit/39ac121309f5c270c8fdc97c45a845542dd78681.diff
LOG: [Clang] Check that we have the correct RecordDecl (#111448)
Ensure we have the correct RecordDecl before returning the Expr we're
looking for.
Added:
Modified:
clang/lib/CodeGen/CGExpr.cpp
Removed:
################################################################################
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) {
More information about the cfe-commits
mailing list