mirror of
				https://github.com/MaskRay/ccls.git
				synced 2025-11-03 22:04:24 +00:00 
			
		
		
		
	Try parsing with full argv. Also hide system diagnostics.
This commit is contained in:
		
							parent
							
								
									c77531a432
								
							
						
					
					
						commit
						839f3d9968
					
				
							
								
								
									
										5
									
								
								foo/.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								foo/.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							@ -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/.*"
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										15
									
								
								foo/b.cc
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								foo/b.cc
									
									
									
									
									
								
							@ -3,9 +3,16 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct Baz {
 | 
					struct Baz3 {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void foo() {
 | 
					
 | 
				
			||||||
  Baz b;
 | 
					struct Foobar {
 | 
				
			||||||
}
 | 
					
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -227,14 +227,16 @@ 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);
 | 
				
			||||||
    clang_getSpellingLocation(location, &file, &line, &column, nullptr);
 | 
					    if (!clang_Location_isInSystemHeader(location)) {
 | 
				
			||||||
 | 
					      clang_getSpellingLocation(location, &file, &line, &column, nullptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Fetch path, print.
 | 
					      // Fetch path, print.
 | 
				
			||||||
    if (file != nullptr) {
 | 
					      if (file != nullptr) {
 | 
				
			||||||
      std::string path = clang::ToString(clang_getFileName(file));
 | 
					        std::string path = clang::ToString(clang_getFileName(file));
 | 
				
			||||||
      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);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -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) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user