|
|
|
@ -390,12 +390,13 @@ void Source::ClangViewParse::update_diagnostics() { |
|
|
|
diagnostic.fix_its.emplace_back(clangmm::Diagnostic::FixIt{"#include <" + *cpp_header + ">\n", file_path.string(), get_new_include_offsets()}); |
|
|
|
diagnostic.fix_its.emplace_back(clangmm::Diagnostic::FixIt{"#include <" + *cpp_header + ">\n", file_path.string(), get_new_include_offsets()}); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
if(diagnostic.fix_its.empty() && diagnostic.severity >= clangmm::Diagnostic::Severity::Error) { |
|
|
|
if(diagnostic.fix_its.empty() && diagnostic.severity >= clangmm::Diagnostic::Severity::Warning) { |
|
|
|
for(size_t c = 0; c < clang_tokens->size(); c++) { |
|
|
|
for(size_t c = 0; c < clang_tokens->size(); c++) { |
|
|
|
auto &token = (*clang_tokens)[c]; |
|
|
|
auto &token = (*clang_tokens)[c]; |
|
|
|
auto &token_offsets = clang_tokens_offsets[c]; |
|
|
|
auto &token_offsets = clang_tokens_offsets[c]; |
|
|
|
if(static_cast<unsigned int>(line) == token_offsets.first.line - 1 && static_cast<unsigned int>(index) >= token_offsets.first.index - 1 && static_cast<unsigned int>(index) <= token_offsets.second.index - 1) { |
|
|
|
if(static_cast<unsigned int>(line) == token_offsets.first.line - 1 && static_cast<unsigned int>(index) >= token_offsets.first.index - 1 && static_cast<unsigned int>(index) <= token_offsets.second.index - 1) { |
|
|
|
if(starts_with(diagnostic.spelling, "implicit instantiation of undefined template")) { |
|
|
|
if(diagnostic.severity >= clangmm::Diagnostic::Severity::Error && |
|
|
|
|
|
|
|
starts_with(diagnostic.spelling, "implicit instantiation of undefined template")) { |
|
|
|
size_t start = 44 + 2; |
|
|
|
size_t start = 44 + 2; |
|
|
|
if(start < diagnostic.spelling.size()) { |
|
|
|
if(start < diagnostic.spelling.size()) { |
|
|
|
auto end = diagnostic.spelling.find('<', start); |
|
|
|
auto end = diagnostic.spelling.find('<', start); |
|
|
|
@ -417,7 +418,8 @@ void Source::ClangViewParse::update_diagnostics() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(is_token_char(*start) && token.get_kind() == clangmm::Token::Kind::Identifier && |
|
|
|
if(is_token_char(*start) && token.get_kind() == clangmm::Token::Kind::Identifier) { |
|
|
|
|
|
|
|
if(diagnostic.severity >= clangmm::Diagnostic::Severity::Error && |
|
|
|
(starts_with(diagnostic.spelling, "unknown type name") || |
|
|
|
(starts_with(diagnostic.spelling, "unknown type name") || |
|
|
|
starts_with(diagnostic.spelling, "no type named") || |
|
|
|
starts_with(diagnostic.spelling, "no type named") || |
|
|
|
starts_with(diagnostic.spelling, "no member named") || |
|
|
|
starts_with(diagnostic.spelling, "no member named") || |
|
|
|
@ -439,9 +441,12 @@ void Source::ClangViewParse::update_diagnostics() { |
|
|
|
(*clang_tokens)[c - 2].get_spelling() == "std") |
|
|
|
(*clang_tokens)[c - 2].get_spelling() == "std") |
|
|
|
has_std = true; |
|
|
|
has_std = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
add_include_fixit(has_std, is_cpp && has_using_namespace_std(c), token_string); |
|
|
|
add_include_fixit(has_std, is_cpp && has_using_namespace_std(c), token_string); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if(diagnostic.severity >= clangmm::Diagnostic::Severity::Warning && is_c && |
|
|
|
|
|
|
|
starts_with(diagnostic.spelling, "implicitly declaring library function")) |
|
|
|
|
|
|
|
add_include_fixit(false, false, get_token(start)); |
|
|
|
|
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|