[llvm-commits] [llvm] r139279 - /llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp

James Molloy james.molloy at arm.com
Thu Sep 8 00:34:45 PDT 2011


Hi Andrew,

Thanks for fixing this - interesting that neither our windows build nor our
linux builds picked this up.

The alternative would have been to declare the return value from .str() as a
stack-local variable, then it would have been forced to exist for the entire
stack frame.

Rookie mistake on my part, sorry!

James 

> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-
> bounces at cs.uiuc.edu] On Behalf Of Andrew Trick
> Sent: 08 September 2011 06:26
> To: llvm-commits at cs.uiuc.edu
> Subject: [llvm-commits] [llvm] r139279 -
> /llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
> 
> Author: atrick
> Date: Thu Sep  8 00:25:49 2011
> New Revision: 139279
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=139279&view=rev
> Log:
> Fix a use of freed string contents.
> 
> Speculatively try to fix our windows testers with a patch I found on the
> internet.
> 
> Modified:
>     llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
> 
> Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp?rev=139279&r1=
> 139278&r2=139279&view=diff
> ===========================================================================
> ===
> --- llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp (original)
> +++ llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Thu Sep  8
> 00:25:49 2011
> @@ -764,11 +764,11 @@
> 
>  static void emitSinglePredicateMatch(raw_ostream &o, StringRef str,
>                                       std::string PredicateNamespace) {
> -  const char *X = str.str().c_str();
> -  if (X[0] == '!')
> -    o << "!(Bits & " << PredicateNamespace << "::" << &X[1] << ")";
> +  if (str[0] == '!')
> +    o << "!(Bits & " << PredicateNamespace << "::"
> +      << str.slice(1,str.size()) << ")";
>    else
> -    o << "(Bits & " << PredicateNamespace << "::" << X << ")";
> +    o << "(Bits & " << PredicateNamespace << "::" << str << ")";
>  }
> 
>  bool FilterChooser::emitPredicateMatch(raw_ostream &o, unsigned
> &Indentation,
> 
> 
> _______________________________________________
> 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