From 12ad5681594153c6662f6ff70b83bd29868389d9 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 15 Apr 2018 10:21:26 -0700 Subject: [PATCH] Update loguru --- CMakeLists.txt | 30 +++++++++++++++--------------- src/clang_indexer.cc | 5 ++--- src/command_line.cc | 3 +++ third_party/loguru | 2 +- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5183c7e..9ecb4680 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,12 +4,12 @@ project(ccls LANGUAGES CXX) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) include(DefaultCMakeBuildType) -# Required libclang version -set(LIBCLANG_VERSION 6.0.0 CACHE STRING "libclang version") -set(LIBCLANG_DOWNLOAD_LOCATION ${CMAKE_BINARY_DIR} - CACHE STRING "Downloaded libclang location") -option(SYSTEM_LIBCLANG "Use system installation of libclang instead of \ - downloading libclang" OFF) +# Required Clang version +set(CLANG_VERSION 6.0.0 CACHE STRING "Clang version") +set(CLANG_DOWNLOAD_LOCATION ${CMAKE_BINARY_DIR} + CACHE STRING "Downloaded Clang location") +option(SYSTEM_CLANG "Use system installation of Clang instead of \ + downloading Clang" OFF) option(ASAN "Compile with address sanitizers" OFF) # Sources for the executable are specified at end of CMakeLists.txt @@ -72,23 +72,23 @@ else() endif() endif() -### Download libclang if required +### Download Clang if required + +if(NOT SYSTEM_CLANG) + message(STATUS "Using downloaded Clang") -if(NOT SYSTEM_LIBCLANG) - message(STATUS "Using downloaded libclang") - include(DownloadAndExtractClang) - download_and_extract_clang(${LIBCLANG_VERSION} ${LIBCLANG_DOWNLOAD_LOCATION}) + download_and_extract_clang(${CLANG_VERSION} ${CLANG_DOWNLOAD_LOCATION}) # Used by FindClang set(CLANG_ROOT ${DOWNLOADED_CLANG_DIR}) else() - message(STATUS "Using system libclang") + message(STATUS "Using system Clang") endif() ### Libraries # See cmake/FindClang.cmake -find_package(Clang ${LIBCLANG_VERSION} REQUIRED) +find_package(Clang ${CLANG_VERSION} REQUIRED) target_link_libraries(ccls PRIVATE Clang::Clang) # Enable threading support @@ -142,7 +142,7 @@ target_include_directories(ccls PRIVATE install(TARGETS ccls RUNTIME DESTINATION bin) # TODO: install libclang.dll on Windows as well -if(NOT SYSTEM_LIBCLANG AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL Windows) +if(NOT SYSTEM_CLANG AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL Windows) if(${CMAKE_SYSTEM_NAME} MATCHES Linux|FreeBSD) set_property(TARGET ccls APPEND PROPERTY @@ -158,7 +158,7 @@ if(NOT SYSTEM_LIBCLANG AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL Windows) endif() # Allow running from build Windows by copying libclang.dll to build directory -if(NOT SYSTEM_LIBCLANG AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows) +if(NOT SYSTEM_CLANG AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows) add_custom_command(TARGET ccls POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy diff --git a/src/clang_indexer.cc b/src/clang_indexer.cc index d0405321..6c6426b0 100644 --- a/src/clang_indexer.cc +++ b/src/clang_indexer.cc @@ -664,9 +664,8 @@ void SetVarDetail(IndexVar* var, } if (is_first_seen) { - std::optional var_type = - ResolveToDeclarationType(db, cursor, param); - if (var_type) { + if (std::optional var_type = + ResolveToDeclarationType(db, cursor, param)) { // Don't treat enum definition variables as instantiations. bool is_enum_member = semanticContainer && semanticContainer->cursor.kind == CXCursor_EnumDecl; diff --git a/src/command_line.cc b/src/command_line.cc index 6eb15596..1e569138 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -341,6 +341,9 @@ int main(int argc, char** argv) { if (!HasOption(options, "--log-all-to-stderr")) loguru::g_stderr_verbosity = loguru::Verbosity_WARNING; + loguru::g_preamble_date = false; + loguru::g_preamble_time = false; + loguru::g_preamble_verbose = false; loguru::g_flush_interval_ms = 0; loguru::init(argc, argv); diff --git a/third_party/loguru b/third_party/loguru index 2c35b5e7..6bf94c5f 160000 --- a/third_party/loguru +++ b/third_party/loguru @@ -1 +1 @@ -Subproject commit 2c35b5e7251ab5d364b1b3164eccef7b5d2293c5 +Subproject commit 6bf94c5f2bec437e871402d0a27e8a3094b261d5