llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.86k stars 11.92k forks source link

llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h: 2 * pointless copy #94385

Open dcb314 opened 5 months ago

dcb314 commented 5 months ago

Static analyser cppcheck says:

trunk/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h:215:52: performance: Function parameter 'LHS' should be passed by const reference. [passedByValue] trunk/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h:216:52: performance: Function parameter 'RHS' should be passed by const reference. [passedByValue]

Source code is

static bool isEqual(codeview::GloballyHashedType LHS, codeview::GloballyHashedType RHS) {

Maybe better code:

static bool isEqual( const codeview::GloballyHashedType & LHS, const codeview::GloballyHashedType & RHS) {

llvmbot commented 5 months ago

@llvm/issue-subscribers-debuginfo

Author: None (dcb314)

Static analyser cppcheck says: trunk/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h:215:52: performance: Function parameter 'LHS' should be passed by const reference. [passedByValue] trunk/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h:216:52: performance: Function parameter 'RHS' should be passed by const reference. [passedByValue] Source code is static bool isEqual(codeview::GloballyHashedType LHS, codeview::GloballyHashedType RHS) { Maybe better code: static bool isEqual( const codeview::GloballyHashedType & LHS, const codeview::GloballyHashedType & RHS) {