[llvm] fc08cfb - CodeView: static_cast result of getOffset() to size_t.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 16 23:41:10 PDT 2021


Author: Peter Collingbourne
Date: 2021-09-16T23:39:04-07:00
New Revision: fc08cfb8884db2f0a871479f7fc640e364a9ffe9

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

LOG: CodeView: static_cast result of getOffset() to size_t.

Silences a narrowing conversion warning on 32-bit platforms after D109923.

Added: 
    

Modified: 
    llvm/lib/DebugInfo/CodeView/SimpleTypeSerializer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/CodeView/SimpleTypeSerializer.cpp b/llvm/lib/DebugInfo/CodeView/SimpleTypeSerializer.cpp
index ac3b30175956e..d963e34628dbc 100644
--- a/llvm/lib/DebugInfo/CodeView/SimpleTypeSerializer.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SimpleTypeSerializer.cpp
@@ -53,7 +53,7 @@ ArrayRef<uint8_t> SimpleTypeSerializer::serialize(T &Record) {
   Prefix->RecordKind = CVT.kind();
   Prefix->RecordLen = Writer.getOffset() - sizeof(uint16_t);
 
-  return {ScratchBuffer.data(), Writer.getOffset()};
+  return {ScratchBuffer.data(), static_cast<size_t>(Writer.getOffset())};
 }
 
 // Explicitly instantiate the member function for each known type so that we can


        


More information about the llvm-commits mailing list