[Lldb-commits] [lldb] r261356 - Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 19 12:33:19 PST 2016


Please don't make this sort of change.  With the code as originally written, I can set a breakpoint on the returns "true" or "false" case separately, and stop there if I am doing that experiment, whereas your change makes that impossible.  Neither one is particularly harder to read than the other, but your version is significantly harder to debug.

Jim

> On Feb 19, 2016, at 11:33 AM, Eugene Zelenko via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> regex_chars (const char comp)
> {
> -    if (comp == '[' || comp == ']' ||
> -        comp == '(' || comp == ')' ||
> -        comp == '{' || comp == '}' ||
> -        comp == '+' ||
> -        comp == '.' ||
> -        comp == '*' ||
> -        comp == '|' ||
> -        comp == '^' ||
> -        comp == '$' ||
> -        comp == '\\' ||
> -        comp == '?')
> -        return true;
> -    else
> -        return false;
> -}
> -CommandCompletions::SymbolCompleter::SymbolCompleter 
> -(
> -    CommandInterpreter &interpreter,
> -    const char *completion_str,
> -    int match_start_point,
> -    int max_return_elements,
> -    StringList &matches
> -) :
> +    return (comp == '[' || comp == ']' ||
> +            comp == '(' || comp == ')' ||
> +            comp == '{' || comp == '}' ||
> +            comp == '+' ||
> +            comp == '.' ||
> +            comp == '*' ||
> +            comp == '|' ||
> +            comp == '^' ||
> +            comp == '$' ||
> +            comp == '\\' ||
> +            comp == '?');
> +}
> +



More information about the lldb-commits mailing list