[clang] [clang][bytecode] Use SmallVector for Function::Code (PR #151821)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 2 07:51:47 PDT 2025


================
@@ -135,7 +135,7 @@ int32_t ByteCodeEmitter::getOffset(LabelTy Label) {
 /// 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<std::byte> &Code, const T &Val,
+static void emit(Program &P, llvm::SmallVector<std::byte> &Code, const T &Val,
----------------
zwuis wrote:

We can use `llvm::SmallVectorImpl<std::byte> &` as parameter type because we don't care the number of inlined elements here.

https://github.com/llvm/llvm-project/pull/151821


More information about the cfe-commits mailing list