From: Benjamin Kramer Date: Sun, 12 Jun 2016 19:02:34 +0000 (+0000) Subject: Use 'auto' to avoid implicit copies. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d92b0de878370e42b27fa8cf85636e82497c7a1c;p=llvm Use 'auto' to avoid implicit copies. td_type is std::pair, but the map returns elements of std::pair. In well-designed languages like C++ that yields an implicit copy perfectly hidden by constref's lifetime extension. Just use auto, the typedef obscured the real type anyways. Found with a little help from clang-tidy's performance-implicit-cast-in-loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272519 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp index 0b775337be5..8d2dc5ef671 100644 --- a/lib/IR/Attributes.cpp +++ b/lib/IR/Attributes.cpp @@ -792,7 +792,7 @@ AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index, } // Add target-dependent (string) attributes. - for (const AttrBuilder::td_type &TDA : B.td_attrs()) + for (const auto &TDA : B.td_attrs()) Attrs.push_back( std::make_pair(Index, Attribute::get(C, TDA.first, TDA.second)));