Try parsing with full argv. Also hide system diagnostics.

This commit is contained in:
Jacob Dufault 2017-04-25 19:12:06 -07:00
parent c77531a432
commit 839f3d9968
6 changed files with 25 additions and 16 deletions

View File

@ -1,5 +1,8 @@
// Place your settings in this file to overwrite default and user settings. // Place your settings in this file to overwrite default and user settings.
{ {
"editor.lineNumbers": "on", "editor.lineNumbers": "on",
"cquery.cacheDirectory": "C:/Users/jacob/Desktop/superindex/indexer/foo/CACHE" "cquery.cacheDirectory": "C:/Users/jacob/Desktop/superindex/indexer/foo/CACHE",
"cquery.blacklist": [
".*/CACHE/.*"
]
} }

View File

@ -14,9 +14,5 @@
void foobar() {} void foobar() {}

View File

@ -3,9 +3,16 @@
struct Baz { struct Baz3 {
}; };
void foo() {
Baz b; struct Foobar {
}
};

View File

@ -227,6 +227,7 @@ void diagnostic(CXClientData client_data,
CXFile file; CXFile file;
unsigned int line, column; unsigned int line, column;
CXSourceLocation location = clang_getDiagnosticLocation(diagnostic); CXSourceLocation location = clang_getDiagnosticLocation(diagnostic);
if (!clang_Location_isInSystemHeader(location)) {
clang_getSpellingLocation(location, &file, &line, &column, nullptr); clang_getSpellingLocation(location, &file, &line, &column, nullptr);
// Fetch path, print. // Fetch path, print.
@ -235,6 +236,7 @@ void diagnostic(CXClientData client_data,
std::cerr << NormalizePath(path) << ':'; std::cerr << NormalizePath(path) << ':';
} }
std::cerr << line << ':' << column << ": " << spelling << std::endl; std::cerr << line << ':' << column << ": " << spelling << std::endl;
}
clang_disposeDiagnostic(diagnostic); clang_disposeDiagnostic(diagnostic);
} }

View File

@ -32,7 +32,7 @@ TranslationUnit::TranslationUnit(IndexerConfig* config,
std::cerr << arg << " "; std::cerr << arg << " ";
std::cerr << std::endl; std::cerr << std::endl;
CXErrorCode error_code = clang_parseTranslationUnit2( CXErrorCode error_code = clang_parseTranslationUnit2FullArgv(
index.cx_index, filepath.c_str(), args.data(), args.size(), index.cx_index, filepath.c_str(), args.data(), args.size(),
unsaved_files.data(), unsaved_files.size(), flags, &cx_tu); unsaved_files.data(), unsaved_files.size(), flags, &cx_tu);

View File

@ -205,6 +205,7 @@ std::vector<Project::Entry> LoadCompilationEntriesFromDirectory(const std::strin
// TODO: Figure out if this function or the clang one is faster. // TODO: Figure out if this function or the clang one is faster.
//return LoadFromCompileCommandsJson(project_directory); //return LoadFromCompileCommandsJson(project_directory);
std::cerr << "Trying to load compile_commands.json" << std::endl;
CXCompilationDatabase_Error cx_db_load_error; CXCompilationDatabase_Error cx_db_load_error;
CXCompilationDatabase cx_db = clang_CompilationDatabase_fromDirectory(project_directory.c_str(), &cx_db_load_error); CXCompilationDatabase cx_db = clang_CompilationDatabase_fromDirectory(project_directory.c_str(), &cx_db_load_error);
if (cx_db_load_error == CXCompilationDatabase_CanNotLoadDatabase) { if (cx_db_load_error == CXCompilationDatabase_CanNotLoadDatabase) {