[llvm-commits] [llvm] r135669 - in /llvm/trunk: include/llvm/ADT/STLExtras.h lib/Support/StringExtras.cpp lib/Transforms/IPO/GlobalOpt.cpp lib/Transforms/Scalar/IndVarSimplify.cpp lib/Transforms/Scalar/SCCP.cpp lib/VMCore/Module.cpp utils/TableGe

David Blaikie dblaikie at gmail.com
Wed Jul 20 23:35:20 PDT 2011


> move tier out of an anonymous namespace, it doesn't make sense
> to for it to be an an anon namespace and be in a header.

Thanks!

> Eliminate some extraenous uses of tie.

Just curious - which usage do you consider to be appropriate use of
tie & which is extraneous? Several of the cases seem like the help
readability by naming the variables & aren't much/any longer than the
version using the pair directly. And the example below seems like what
I would consider a canonical use case for tie. I take it you'd only
consider tie appropriate when both variables are not coming into
existence at the point of the tie, but instead are both coming from
broader scopes?

> -    std::string OpName;
> -    tie(OpName, DisableEncoding) = getToken(DisableEncoding, " ,\t");
> +    std::pair<StringRef, StringRef> P = getToken(DisableEncoding, " ,\t");
> +    std::string OpName = P.first;
> +    DisableEncoding = P.second;
>     if (OpName.empty()) break;
>
>     // Figure out which operand this is.




More information about the llvm-commits mailing list