[clang] [clang][dataflow] fix assert in `Environment::getResultObjectLocation` (PR #79608)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 26 07:45:11 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Paul Semel (paulsemel)
<details>
<summary>Changes</summary>
When calling `Environment::getResultObjectLocation` with a CXXOperatorCallExpr that is a prvalue, we just hit an assert because no record was ever created.
---
Full diff: https://github.com/llvm/llvm-project/pull/79608.diff
1 Files Affected:
- (modified) clang/lib/Analysis/FlowSensitive/Transfer.cpp (+5)
``````````diff
diff --git a/clang/lib/Analysis/FlowSensitive/Transfer.cpp b/clang/lib/Analysis/FlowSensitive/Transfer.cpp
index 2271a75fbcaf709..3b028a3200b72b2 100644
--- a/clang/lib/Analysis/FlowSensitive/Transfer.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Transfer.cpp
@@ -536,6 +536,11 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
copyRecord(*LocSrc, *LocDst, Env);
Env.setStorageLocation(*S, *LocDst);
+ } else {
+ // CXXOperatorCallExpr can be prvalues, in which case we must create a
+ // record for them in order for `Environment::getResultObjectLocation()`
+ // to be able to return a value.
+ VisitCallExpr(S);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/79608
More information about the cfe-commits
mailing list