[clang] [clang][Interp] Integral pointers (PR #84159)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 6 05:55:46 PST 2024
================
@@ -53,6 +57,10 @@ class FunctionPointer final {
return toAPValue().getAsString(Ctx, Func->getDecl()->getType());
}
+ uint32_t getIntegerRepresentation() const {
+ return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(Func));
+ }
----------------
AaronBallman wrote:
This seems dangerous to me. `Func` is a pointer, so casting to `uintptr_t` makes sense, but then casting to a 32-bit value seems likely to cause problems due to truncation. Any reason why this shouldn't return a `uintptr_t`?
https://github.com/llvm/llvm-project/pull/84159
More information about the cfe-commits
mailing list