[llvm-branch-commits] [llvm] 259936f - [NFC][AsmPrinter] Windows warning: Use explicit cast

David Stuttard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 14 01:16:52 PST 2021


Author: David Stuttard
Date: 2021-01-14T09:10:31Z
New Revision: 259936f4910ad7da7589f81862fc855386ae8621

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

LOG: [NFC][AsmPrinter] Windows warning: Use explicit cast

static_cast for uint64_t to unsigned gives a MS VC build warning
for Windows:

warning C4309: 'static_cast': truncation of constant value

Use an explicit cast instead.

Change-Id: I692d335b4913070686a102780c1fb05b893a2f69

Differential Revision: https://reviews.llvm.org/D94592

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index f4749f8ca95d..85754bf29d0c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -846,7 +846,7 @@ static void emitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
     CommentOS << *Size << "-byte Reload\n";
   } else if ((Size = MI.getFoldedRestoreSize(TII))) {
     if (*Size) {
-      if (*Size == static_cast<unsigned>(MemoryLocation::UnknownSize))
+      if (*Size == unsigned(MemoryLocation::UnknownSize))
         CommentOS << "Unknown-size Folded Reload\n";
       else
         CommentOS << *Size << "-byte Folded Reload\n";
@@ -855,7 +855,7 @@ static void emitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
     CommentOS << *Size << "-byte Spill\n";
   } else if ((Size = MI.getFoldedSpillSize(TII))) {
     if (*Size) {
-      if (*Size == static_cast<unsigned>(MemoryLocation::UnknownSize))
+      if (*Size == unsigned(MemoryLocation::UnknownSize))
         CommentOS << "Unknown-size Folded Spill\n";
       else
         CommentOS << *Size << "-byte Folded Spill\n";


        


More information about the llvm-branch-commits mailing list