Fix -Wconversion errors

This commit is contained in:
Jonathan Müller 2017-04-24 09:58:21 +02:00
commit b8ad3acb79
2 changed files with 7 additions and 3 deletions

View file

@ -30,7 +30,11 @@ namespace
{
unsigned offset;
clang_getSpellingLocation(loc, nullptr, nullptr, nullptr, &offset);
return clang_getLocationForOffset(tu, file, offset + inc);
if (inc >= 0)
offset += unsigned(inc);
else
offset -= unsigned(-inc);
return clang_getLocationForOffset(tu, file, offset);
}
class simple_tokenizer
@ -312,7 +316,7 @@ detail::token_iterator detail::find_closing_bracket(detail::token_stream stream)
--bracket_count;
else if (paren_count == 0 && template_bracket && cur == ">>")
// maximal munch
bracket_count -= 2u;
bracket_count -= 2;
else if (cur == "(" || cur == "{" || cur == "[")
++paren_count;
else if (cur == ")" || cur == "}" || cur == "]")

View file

@ -288,7 +288,7 @@ int main(int argc, char* argv[])
logger.set_verbose(true);
auto file = parse_file(config, logger, options["file"].as<std::string>(),
options.count("fatal_errors") == 1u);
options.count("fatal_errors") == 1);
if (!file)
return 2;
print_ast(std::cout, *file);