[Mlir-commits] [mlir] ae97b5a - [mlir:Bytecode] Move variable to inside of the lambda to fix MSVC build

River Riddle llvmlistbot at llvm.org
Tue Aug 23 17:44:22 PDT 2022


Author: River Riddle
Date: 2022-08-23T17:43:53-07:00
New Revision: ae97b5acf85de913d05f720f982d7a017369a01a

URL: https://github.com/llvm/llvm-project/commit/ae97b5acf85de913d05f720f982d7a017369a01a
DIFF: https://github.com/llvm/llvm-project/commit/ae97b5acf85de913d05f720f982d7a017369a01a.diff

LOG: [mlir:Bytecode] Move variable to inside of the lambda to fix MSVC build

MSVC is not picking up a variable capture somehow, try moving it inside.

Added: 
    

Modified: 
    mlir/lib/Bytecode/Writer/BytecodeWriter.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
index 6fc2fb4354db..460471b649e5 100644
--- a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
+++ b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
@@ -401,9 +401,6 @@ void BytecodeWriter::writeAttrTypeSection(EncodingEmitter &emitter) {
   offsetEmitter.emitVarInt(llvm::size(numberingState.getAttributes()));
   offsetEmitter.emitVarInt(llvm::size(numberingState.getTypes()));
 
-  // The writer used when emitting using a custom bytecode encoding.
-  DialectWriter dialectWriter(attrTypeEmitter, numberingState, stringSection);
-
   // A functor used to emit an attribute or type entry.
   uint64_t prevOffset = 0;
   auto emitAttrOrType = [&](auto &entry) {
@@ -412,6 +409,10 @@ void BytecodeWriter::writeAttrTypeSection(EncodingEmitter &emitter) {
     // First, try to emit this entry using the dialect bytecode interface.
     bool hasCustomEncoding = false;
     if (const BytecodeDialectInterface *interface = entry.dialect->interface) {
+      // The writer used when emitting using a custom bytecode encoding.
+      DialectWriter dialectWriter(attrTypeEmitter, numberingState,
+                                  stringSection);
+
       if constexpr (std::is_same_v<std::decay_t<decltype(entryValue)>, Type>) {
         // TODO: We don't currently support custom encoded mutable types.
         hasCustomEncoding =


        


More information about the Mlir-commits mailing list