const char *str, *s;
if (token.type == LSTOKEN_KEYWORD)
- return gdb::unique_xmalloc_ptr<char> (xstrdup (LS_TOKEN_KEYWORD (token)));
+ return make_unique_xstrdup (LS_TOKEN_KEYWORD (token));
str = LS_TOKEN_STOKEN (token).ptr;
s = remove_trailing_whitespace (str, str + LS_TOKEN_STOKEN (token).length);
/* Do not tokenize ABI tags such as "[abi:cxx11]". */
else if (PARSER_STREAM (parser) - start > 4
&& startswith (PARSER_STREAM (parser) - 4, "[abi"))
- ++(PARSER_STREAM (parser));
+ {
+ /* Nothing. */
+ }
/* Do not tokenify if the input length so far is one
(i.e, a single-letter drive name) and the next character
}
/* Advance the stream. */
+ gdb_assert (*(PARSER_STREAM (parser)) != '\0');
++(PARSER_STREAM (parser));
}
}
if (source_filename != NULL)
{
- TRY
+ try
{
*result->file_symtabs
= symtabs_from_filename (source_filename, self->search_pspace);
}
- CATCH (except, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &except)
{
source_file_not_found_error (source_filename);
}
- END_CATCH
result->explicit_loc.source_filename = xstrdup (source_filename);
}
else
symbol_name_match_type match_type)
{
linespec_token token;
- struct gdb_exception file_exception = exception_none;
+ struct gdb_exception file_exception;
/* A special case to start. It has become quite popular for
IDEs to work around bugs in the previous parser by quoting
gdb::unique_xmalloc_ptr<char> user_filename = copy_token_string (token);
/* Check if the input is a filename. */
- TRY
+ try
{
*PARSER_RESULT (parser)->file_symtabs
= symtabs_from_filename (user_filename.get (),
PARSER_STATE (parser)->search_pspace);
}
- CATCH (ex, RETURN_MASK_ERROR)
+ catch (gdb_exception_error &ex)
{
- file_exception = ex;
+ file_exception = std::move (ex);
}
- END_CATCH
if (file_exception.reason >= 0)
{
/* The linespec didn't parse. Re-throw the file exception if
there was one. */
if (file_exception.reason < 0)
- throw_exception (file_exception);
+ throw_exception (std::move (file_exception));
/* Otherwise, the symbol is not found. */
symbol_not_found_error (PARSER_EXPLICIT (parser)->function_name,
line_offset unknown_offset = { 0, LINE_OFFSET_UNKNOWN };
- TRY
+ try
{
convert_explicit_location_to_linespec (PARSER_STATE (&parser),
PARSER_RESULT (&parser),
func_name_match_type,
NULL, unknown_offset);
}
- CATCH (ex, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &ex)
{
return;
}
- END_CATCH
complete_label (tracker, &parser, label_name);
}
/* Parse as much as possible. parser.completion_word will hold
furthest completion point we managed to parse to. */
- TRY
+ try
{
parse_linespec (&parser, text, match_type);
}
- CATCH (except, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &except)
{
}
- END_CATCH
if (parser.completion_quote_char != '\0'
&& parser.completion_quote_end != NULL
case LINESPEC_LOCATION:
{
PARSER_STATE (parser)->is_linespec = 1;
- TRY
+ try
{
const linespec_location *ls = get_linespec_location (location);
result = parse_linespec (parser,
ls->spec_string, ls->match_type);
}
- CATCH (except, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &except)
{
- throw_exception (except);
+ throw;
}
- END_CATCH
}
break;
if (!classes.empty ())
{
/* Now locate a list of suitable methods named METHOD. */
- TRY
+ try
{
find_method (state, file_symtabs,
klass.c_str (), method.c_str (),
/* If successful, we're done. If NOT_FOUND_ERROR
was not thrown, rethrow the exception that we did get. */
- CATCH (except, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &except)
{
if (except.error != NOT_FOUND_ERROR)
- throw_exception (except);
+ throw;
}
- END_CATCH
}
}
}