[clang] [clang][ExprConst] Don't create useless temporary variable (PR #67716)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 28 10:41:53 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
<details>
<summary>Changes</summary>
We never use it anyway.
This code has been introduced in
410306bf6ed906af77978caa199e5d96376bae66, but it didn't really do anything back then either, as far as I can tell.
Fixes #<!-- -->57135
---
Full diff: https://github.com/llvm/llvm-project/pull/67716.diff
1 Files Affected:
- (modified) clang/lib/AST/ExprConstant.cpp (+2-10)
``````````diff
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index fea06b97259fe31..04a751f1b4d09fb 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -10950,16 +10950,8 @@ bool ArrayExprEvaluator::VisitCXXParenListOrInitListExpr(
}
bool ArrayExprEvaluator::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) {
- LValue CommonLV;
- if (E->getCommonExpr() &&
- !Evaluate(Info.CurrentCall->createTemporary(
- E->getCommonExpr(),
- getStorageType(Info.Ctx, E->getCommonExpr()),
- ScopeKind::FullExpression, CommonLV),
- Info, E->getCommonExpr()->getSourceExpr()))
- return false;
-
- auto *CAT = cast<ConstantArrayType>(E->getType()->castAsArrayTypeUnsafe());
+ const auto *CAT =
+ cast<ConstantArrayType>(E->getType()->castAsArrayTypeUnsafe());
uint64_t Elements = CAT->getSize().getZExtValue();
Result = APValue(APValue::UninitArray(), Elements, Elements);
``````````
</details>
https://github.com/llvm/llvm-project/pull/67716
More information about the cfe-commits
mailing list