[llvm-commits] [llvm] r161097 - /llvm/trunk/include/llvm/ADT/StringSwitch.h

Sean Silva silvas at purdue.edu
Tue Jul 31 20:23:43 PDT 2012


Ugh. I kind of don't like having a warning for the shadow in this case.

It's actually a useful pattern to have the constructor parameter named
the same as the member it initializes; otherwise you end up doing
contortions coming up with a name, including being pushed to the limit
of engendering undefined behavior
<http://clang.llvm.org/doxygen/CodeGenAction_8cpp_source.html#l00268>
out of desperation for coming up with a name.

--Sean Silva

On Tue, Jul 31, 2012 at 6:43 PM, Nick Kledzik <kledzik at apple.com> wrote:
> Author: kledzik
> Date: Tue Jul 31 20:43:10 2012
> New Revision: 161097
>
> URL: http://llvm.org/viewvc/llvm-project?rev=161097&view=rev
> Log:
> Fix shadowed variable warning
>
> Modified:
>     llvm/trunk/include/llvm/ADT/StringSwitch.h
>
> Modified: llvm/trunk/include/llvm/ADT/StringSwitch.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringSwitch.h?rev=161097&r1=161096&r2=161097&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/StringSwitch.h (original)
> +++ llvm/trunk/include/llvm/ADT/StringSwitch.h Tue Jul 31 20:43:10 2012
> @@ -48,8 +48,8 @@
>    const T *Result;
>
>  public:
> -  explicit StringSwitch(StringRef Str)
> -  : Str(Str), Result(0) { }
> +  explicit StringSwitch(StringRef S)
> +  : Str(S), Result(0) { }
>
>    template<unsigned N>
>    StringSwitch& Case(const char (&S)[N], const T& Value) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list