Remove --debug in favor of LIBCLANG_DISABLE_CRASH_RECOVERY=1

ci/before_deploy.sh: Use the latest libclang.so
This commit is contained in:
Fangrui Song 2018-02-06 23:55:02 -08:00
parent ad5ddb51c4
commit e76a336f19
3 changed files with 3 additions and 26 deletions

View File

@ -23,10 +23,10 @@ esac
pkg=$(mktemp -d) pkg=$(mktemp -d)
mkdir "$pkg/$name" mkdir "$pkg/$name"
rsync -rtLR bin "./${libclang[0]}" ./lib/clang+llvm-*/lib/clang/*/include "$pkg/$name" rsync -rtLR bin "./${libclang[-1]}" ./lib/clang+llvm-*/lib/clang/*/include "$pkg/$name"
cd "$pkg" cd "$pkg"
strip "$strip_option" "$name/bin/cquery" "$name/${libclang[0]}" strip "$strip_option" "$name/bin/cquery" "$name/${libclang[-1]}"
case $(uname -s) in case $(uname -s) in
Darwin) Darwin)
tar -cf filelist --format=mtree --options="!all,time,mode,type" "$name" tar -cf filelist --format=mtree --options="!all,time,mode,type" "$name"

View File

@ -51,7 +51,6 @@
// items per second completed and scales up/down number of running threads. // items per second completed and scales up/down number of running threads.
std::string g_init_options; std::string g_init_options;
bool g_debug;
namespace { namespace {
@ -88,9 +87,6 @@ Mode:
Run as a language server over stdin and stdout Run as a language server over stdin and stdout
Other command line options: Other command line options:
--debug Disable libclang crash recovery so that in case of libclang or
indexer callback issue, the process will crash and we can
get a stack trace.
--init <initializationOptions> --init <initializationOptions>
Override client provided initialization options Override client provided initialization options
https://github.com/cquery-project/cquery/wiki/Initialization-options https://github.com/cquery-project/cquery/wiki/Initialization-options
@ -444,7 +440,6 @@ int main(int argc, char** argv) {
&stdout_waiter); &stdout_waiter);
PlatformInit(); PlatformInit();
g_debug = HasOption(options, "--debug");
IndexInit(); IndexInit();
bool language_server = true; bool language_server = true;
@ -463,7 +458,6 @@ int main(int argc, char** argv) {
} }
if (HasOption(options, "--test-unit")) { if (HasOption(options, "--test-unit")) {
g_debug = true;
language_server = false; language_server = false;
doctest::Context context; doctest::Context context;
context.applyCommandLine(argc, argv); context.applyCommandLine(argc, argv);
@ -473,7 +467,6 @@ int main(int argc, char** argv) {
} }
if (HasOption(options, "--test-index")) { if (HasOption(options, "--test-index")) {
g_debug = true;
language_server = false; language_server = false;
if (!RunIndexTests(options["--test-index"], !HasOption(options, "--ci"))) if (!RunIndexTests(options["--test-index"], !HasOption(options, "--ci")))
return 1; return 1;

View File

@ -18,9 +18,6 @@
// TODO: See if we can use clang_indexLoc_getFileLocation to get a type ref on // TODO: See if we can use clang_indexLoc_getFileLocation to get a type ref on
// |Foobar| in DISALLOW_COPY(Foobar) // |Foobar| in DISALLOW_COPY(Foobar)
// Defined in command_line.cc
extern bool g_debug;
#if CINDEX_VERSION >= 47 #if CINDEX_VERSION >= 47
#define CINDEX_HAVE_PRETTY 1 #define CINDEX_HAVE_PRETTY 1
#endif #endif
@ -699,15 +696,6 @@ void UniqueAdd(std::vector<T>& values, T value) {
IdCache::IdCache(const std::string& primary_file) IdCache::IdCache(const std::string& primary_file)
: primary_file(primary_file) {} : primary_file(primary_file) {}
template <typename T>
bool Contains(const std::vector<T>& vec, const T& element) {
for (const T& entry : vec) {
if (entry == element)
return true;
}
return false;
}
void OnIndexDiagnostic(CXClientData client_data, void OnIndexDiagnostic(CXClientData client_data,
CXDiagnosticSet diagnostics, CXDiagnosticSet diagnostics,
void* reserved) { void* reserved) {
@ -2193,10 +2181,6 @@ optional<std::vector<std::unique_ptr<IndexFile>>> ParseWithTu(
CXIndexAction index_action = clang_IndexAction_create(index->cx_index); CXIndexAction index_action = clang_IndexAction_create(index->cx_index);
// NOTE: libclang re-enables crash recovery whenever a new index is created.
if (g_debug)
clang_toggleCrashRecovery(0);
// |index_result| is a CXErrorCode instance. // |index_result| is a CXErrorCode instance.
int index_result = clang_indexTranslationUnit( int index_result = clang_indexTranslationUnit(
index_action, &param, &callback, sizeof(IndexerCallbacks), index_action, &param, &callback, sizeof(IndexerCallbacks),
@ -2268,7 +2252,7 @@ void ConcatTypeAndName(std::string& type, const std::string& name) {
void IndexInit() { void IndexInit() {
clang_enableStackTraces(); clang_enableStackTraces();
if (!g_debug) if (!getenv("LIBCLANG_DISABLE_CRASH_RECOVERY"))
clang_toggleCrashRecovery(1); clang_toggleCrashRecovery(1);
} }