[clang] 0354f31 - [clang][Interp][NFC] Don't cast primitive types to the same type
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Thu May 4 00:56:58 PDT 2023
Author: Timm Bäder
Date: 2023-05-04T09:53:15+02:00
New Revision: 0354f31b513991d936e8a9af0a50890c48ea01b0
URL: https://github.com/llvm/llvm-project/commit/0354f31b513991d936e8a9af0a50890c48ea01b0
DIFF: https://github.com/llvm/llvm-project/commit/0354f31b513991d936e8a9af0a50890c48ea01b0.diff
LOG: [clang][Interp][NFC] Don't cast primitive types to the same type
We might classify different clang types to the same interp types, so
skip the cast in that case.
No test attached since this is already exercised a few times in the
existing tests.
Added:
Modified:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 7686a2eb71ec..ca9d345c2e86 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -146,7 +146,9 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
if (!this->visit(SubExpr))
return false;
- // TODO: Emit this only if FromT != ToT.
+ if (FromT == ToT)
+ return true;
+
return this->emitCast(*FromT, *ToT, CE);
}
More information about the cfe-commits
mailing list