Author: Timm Bäder Date: 2023-07-13T13:45:48+02:00 New Revision: e35719da5eaf256ecedfba55b50d7c07bfe596c2
URL: https://github.com/llvm/llvm-project/commit/e35719da5eaf256ecedfba55b50d7c07bfe596c2 DIFF: https://github.com/llvm/llvm-project/commit/e35719da5eaf256ecedfba55b50d7c07bfe596c2.diff LOG: [clang][Interp][NFC] Use std::byte for byte code. Added: Modified: clang/lib/AST/Interp/ByteCodeEmitter.cpp clang/lib/AST/Interp/ByteCodeEmitter.h clang/lib/AST/Interp/Function.h clang/lib/AST/Interp/Source.h Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/ByteCodeEmitter.cpp b/clang/lib/AST/Interp/ByteCodeEmitter.cpp index 359e774d12716d..3248877b5f4704 100644 --- a/clang/lib/AST/Interp/ByteCodeEmitter.cpp +++ b/clang/lib/AST/Interp/ByteCodeEmitter.cpp @@ -167,7 +167,7 @@ bool ByteCodeEmitter::bail(const SourceLocation &Loc) { /// Helper to write bytecode and bail out if 32-bit offsets become invalid. /// Pointers will be automatically marshalled as 32-bit IDs. template <typename T> -static void emit(Program &P, std::vector<char> &Code, const T &Val, +static void emit(Program &P, std::vector<std::byte> &Code, const T &Val, bool &Success) { size_t Size; diff --git a/clang/lib/AST/Interp/ByteCodeEmitter.h b/clang/lib/AST/Interp/ByteCodeEmitter.h index a184ee071e9dfb..795534696d92ff 100644 --- a/clang/lib/AST/Interp/ByteCodeEmitter.h +++ b/clang/lib/AST/Interp/ByteCodeEmitter.h @@ -93,7 +93,7 @@ class ByteCodeEmitter { /// Location of label relocations. llvm::DenseMap<LabelTy, llvm::SmallVector<unsigned, 5>> LabelRelocs; /// Program code. - std::vector<char> Code; + std::vector<std::byte> Code; /// Opcode to expression mapping. SourceMap SrcMap; diff --git a/clang/lib/AST/Interp/Function.h b/clang/lib/AST/Interp/Function.h index 6fde5a616dec04..207fb294d6e047 100644 --- a/clang/lib/AST/Interp/Function.h +++ b/clang/lib/AST/Interp/Function.h @@ -164,7 +164,7 @@ class Function final { bool HasThisPointer, bool HasRVO); /// Sets the code of a function. - void setCode(unsigned NewFrameSize, std::vector<char> &&NewCode, + void setCode(unsigned NewFrameSize, std::vector<std::byte> &&NewCode, SourceMap &&NewSrcMap, llvm::SmallVector<Scope, 2> &&NewScopes, bool NewHasBody) { FrameSize = NewFrameSize; @@ -192,7 +192,7 @@ class Function final { /// Size of the argument stack. unsigned ArgSize; /// Program code. - std::vector<char> Code; + std::vector<std::byte> Code; /// Opcode-to-expression mapping. SourceMap SrcMap; /// List of block descriptors. diff --git a/clang/lib/AST/Interp/Source.h b/clang/lib/AST/Interp/Source.h index 3ca6dfd06402ac..f448081362b58d 100644 --- a/clang/lib/AST/Interp/Source.h +++ b/clang/lib/AST/Interp/Source.h @@ -64,9 +64,9 @@ class CodePtr final { private: friend class Function; /// Constructor used by Function to generate pointers. - CodePtr(const char *Ptr) : Ptr(Ptr) {} + CodePtr(const std::byte *Ptr) : Ptr(Ptr) {} /// Pointer into the code owned by a function. - const char *Ptr; + const std::byte *Ptr; }; /// Describes the statement/declaration an opcode was generated from. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits