[clang] [Clang] Check that we have the correct RecordDecl (PR #111448)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 7 15:29:17 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Bill Wendling (bwendling)
<details>
<summary>Changes</summary>
Ensure we have the correct RecordDecl before returning the Expr we're looking for.
---
Full diff: https://github.com/llvm/llvm-project/pull/111448.diff
1 Files Affected:
- (modified) clang/lib/CodeGen/CGExpr.cpp (+1-1)
``````````diff
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) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/111448
More information about the cfe-commits
mailing list