[Lldb-commits] [lldb] r282079 - Make lldb::Regex use StringRef.

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 22 04:53:40 PDT 2016

On 22 September 2016 at 01:00, Greg Clayton via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
> If you use a StringRef in printf, please use "%*s" and then put the count and data pointer into the printf, so the above line would become:
> +  s->Printf("source regex = \"%*s\", exact_match = %d",
> +            (int)m_regex.GetText().size(), m_regex.GetText().data(), m_exact_match);

I think this is a very good argument to use a c++-like api for streams/logging:

s << "source regex = \"" << m_regex.GetText() << "\", exact_match = "
<< m_exact_match;

It's shorter and much less error-prone.

More information about the lldb-commits mailing list