From 368bd9a283fc2b80e8a7e607d98128137f536b60 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 26 Aug 2018 17:22:45 -0700 Subject: [PATCH] SkipFunctionBodiesScope; improve fuzzy --- src/clang_tu.cc | 5 +++-- src/fuzzy_match.cc | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/clang_tu.cc b/src/clang_tu.cc index 0a42a6ee..278e2e75 100644 --- a/src/clang_tu.cc +++ b/src/clang_tu.cc @@ -97,9 +97,10 @@ std::unique_ptr ClangTranslationUnit::Create( /*CacheCodeCompletionResults=*/true, g_config->index.comments, /*AllowPCHWithCompilerErrors=*/true, #if LLVM_VERSION_MAJOR >= 7 - SkipFunctionBodiesScope::None, + diagnostic ? SkipFunctionBodiesScope::None + : SkipFunctionBodiesScope::PreambleAndMainFile, #else - false, + !diagnostic, #endif /*SingleFileParse=*/false, /*UserFilesAreVolatile=*/true, false, diff --git a/src/fuzzy_match.cc b/src/fuzzy_match.cc index ad0762be..08f446b4 100644 --- a/src/fuzzy_match.cc +++ b/src/fuzzy_match.cc @@ -31,7 +31,7 @@ void CalculateRoles(std::string_view s, int roles[], int *class_set) { if (cur == Other) return None; // U(U)L is Head while U(U)U is Tail - return pre == Other || (cur == Upper && (pre == Lower || suc != Upper)) + return pre == Other || (cur == Upper && (pre == Lower || suc == Lower)) ? Head : Tail; };