Timm =?utf-8?q?Bäder?= <tbae...@redhat.com> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/144...@github.com>
================ @@ -17,63 +17,80 @@ #include "clang/AST/APValue.h" #include "llvm/ADT/APFloat.h" +// XXX This is just a debugging help. Setting this to 1 will heap-allocate ALL +// floating values. +#define ALLOCATE_ALL 0 + namespace clang { namespace interp { using APFloat = llvm::APFloat; using APSInt = llvm::APSInt; +using APInt = llvm::APInt; +/// If a Floating is constructed from Memory, it DOES NOT OWN THAT MEMORY. +/// It will NOT copy the memory (unless, of course, copy() is called) an it +/// won't alllocate anything. The allocation should happen via InterpState or +/// Program. class Floating final { private: - // The underlying value storage. - APFloat F; + union { + uint64_t Val = 0; + uint64_t *Memory; + }; + llvm::APFloatBase::Semantics Semantics = ---------------- AaronBallman wrote: I wonder if it's better to leave it without a default initializer so if we ever add a new constructor, we get sanitizer diagnostics if we forget to initialize the field rather than have the wrong semantics? I don't feel strongly, but the default definitely surprised me here. https://github.com/llvm/llvm-project/pull/144246 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits