From 30416425ca1f5fb70a54e5a8f10e18856226bbc5 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 21 Feb 2024 22:47:55 +0000 Subject: [PATCH] Bump to C++17 --- CMakeLists.txt | 2 +- Package.swift | 2 +- lib/Index/IndexDatastore.cpp | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13e9625f..136dfec6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) project(IndexStoreDB LANGUAGES C CXX Swift) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/Package.swift b/Package.swift index 1a1620e9..dae86d82 100644 --- a/Package.swift +++ b/Package.swift @@ -142,5 +142,5 @@ let package = Package( ]), ], - cxxLanguageStandard: .cxx14 + cxxLanguageStandard: .cxx17 ) diff --git a/lib/Index/IndexDatastore.cpp b/lib/Index/IndexDatastore.cpp index 1cb50335..312f10e5 100644 --- a/lib/Index/IndexDatastore.cpp +++ b/lib/Index/IndexDatastore.cpp @@ -1003,13 +1003,12 @@ void UnitMonitor::markOutOfDate(OutOfDateFileTriggerRef trigger, // Note we have to be careful with the memory management here since the // key for OutOfDateTriggers is a reference into the stored trigger value. sys::ScopedLock L(StateMtx); - auto iterAndInserted = + auto [iter, inserted] = OutOfDateTriggers.try_emplace(trigger->getPathRef(), trigger); - if (!iterAndInserted.second) { + if (!inserted) { // If we have the same or newer mod time for this trigger already stored, // we've seen it before, and have already informed the delegate that the // unit is out of date. - auto iter = iterAndInserted.first; if (iter->second->getModTime() >= trigger->getModTime()) return;