[llvm] 0ae989a - Pass DebugLoc::appendInlinedAt DebugLoc arg by const reference not value.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 08:39:28 PDT 2020


Author: Simon Pilgrim
Date: 2020-07-01T16:38:51+01:00
New Revision: 0ae989a1fede0e512e2bfd57b328aad6c1920329

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

LOG: Pass DebugLoc::appendInlinedAt DebugLoc arg by const reference not value.

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

Added: 
    

Modified: 
    llvm/include/llvm/IR/DebugLoc.h
    llvm/lib/IR/DebugLoc.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/DebugLoc.h b/llvm/include/llvm/IR/DebugLoc.h
index 780d17a33661..4914d733fe0d 100644
--- a/llvm/include/llvm/IR/DebugLoc.h
+++ b/llvm/include/llvm/IR/DebugLoc.h
@@ -85,7 +85,7 @@ namespace llvm {
     /// the chain now is inlined-at the new call site.
     /// \param   InlinedAt    The new outermost inlined-at in the chain.
     /// \param   ReplaceLast  Replace the last location in the inlined-at chain.
-    static DebugLoc appendInlinedAt(DebugLoc DL, DILocation *InlinedAt,
+    static DebugLoc appendInlinedAt(const DebugLoc &DL, DILocation *InlinedAt,
                                     LLVMContext &Ctx,
                                     DenseMap<const MDNode *, MDNode *> &Cache,
                                     bool ReplaceLast = false);

diff  --git a/llvm/lib/IR/DebugLoc.cpp b/llvm/lib/IR/DebugLoc.cpp
index 14d1396f1543..e945cbcba782 100644
--- a/llvm/lib/IR/DebugLoc.cpp
+++ b/llvm/lib/IR/DebugLoc.cpp
@@ -79,7 +79,7 @@ DebugLoc DebugLoc::get(unsigned Line, unsigned Col, const MDNode *Scope,
                          const_cast<MDNode *>(InlinedAt), ImplicitCode);
 }
 
-DebugLoc DebugLoc::appendInlinedAt(DebugLoc DL, DILocation *InlinedAt,
+DebugLoc DebugLoc::appendInlinedAt(const DebugLoc &DL, DILocation *InlinedAt,
                                    LLVMContext &Ctx,
                                    DenseMap<const MDNode *, MDNode *> &Cache,
                                    bool ReplaceLast) {


        


More information about the llvm-commits mailing list