[llvm] 32f8cd9 - Pass MDFieldPrinter::printAPInt APInt arg by reference not value.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 09:18:33 PDT 2020


Author: Simon Pilgrim
Date: 2020-06-30T17:18:20+01:00
New Revision: 32f8cd9a6a5600aed7d4001b3a16a191a4db90ab

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

LOG: Pass MDFieldPrinter::printAPInt APInt arg by reference not value.

Noticed by clang-tidy performance-unnecessary-value-param warning.

Added: 
    

Modified: 
    llvm/lib/IR/AsmWriter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 6930ad857964..d408d7a4705b 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1654,7 +1654,7 @@ struct MDFieldPrinter {
                      bool ShouldSkipNull = true);
   template <class IntTy>
   void printInt(StringRef Name, IntTy Int, bool ShouldSkipZero = true);
-  void printAPInt(StringRef Name, APInt Int, bool IsUnsigned,
+  void printAPInt(StringRef Name, const APInt &Int, bool IsUnsigned,
                   bool ShouldSkipZero);
   void printBool(StringRef Name, bool Value, Optional<bool> Default = None);
   void printDIFlags(StringRef Name, DINode::DIFlags Flags);
@@ -1731,8 +1731,8 @@ void MDFieldPrinter::printInt(StringRef Name, IntTy Int, bool ShouldSkipZero) {
   Out << FS << Name << ": " << Int;
 }
 
-void MDFieldPrinter::printAPInt(StringRef Name, APInt Int, bool IsUnsigned,
-                                bool ShouldSkipZero) {
+void MDFieldPrinter::printAPInt(StringRef Name, const APInt &Int,
+                                bool IsUnsigned, bool ShouldSkipZero) {
   if (ShouldSkipZero && Int.isNullValue())
     return;
 


        


More information about the llvm-commits mailing list