Add using declaration to optional.h, include STL optional if available or fallback to third-party one.

This commit is contained in:
Jacob Dufault 2017-12-29 10:29:10 -06:00
parent b6071004df
commit 48f3c75053
16 changed files with 13 additions and 55 deletions

View File

@ -1,12 +1,10 @@
#pragma once #pragma once
#include <optional.h> #include <optional.h>
#include <memory> #include <memory>
#include <string> #include <string>
using std::experimental::nullopt;
using std::experimental::optional;
struct Config; struct Config;
struct IndexFile; struct IndexFile;

View File

@ -1,14 +1,11 @@
#pragma once #pragma once
#include <optional.h>
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <optional.h>
#include <string> #include <string>
#include <vector> #include <vector>
using std::experimental::optional;
class ClangType { class ClangType {
public: public:
ClangType(); ClangType();

View File

@ -3,8 +3,8 @@
#include "language_server_api.h" #include "language_server_api.h"
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <optional.h> #include <optional.h>
#include <vector> #include <vector>
using namespace std::experimental; using namespace std::experimental;

View File

@ -6,9 +6,6 @@
#include <mutex> #include <mutex>
using namespace std::experimental;
using std::experimental::nullopt;
// Cached completion information, so we can give fast completion results when // Cached completion information, so we can give fast completion results when
// the user erases a character. vscode will resend the completion request if // the user erases a character. vscode will resend the completion request if
// that happens. // that happens.

View File

@ -5,9 +5,9 @@
#include "serializer.h" #include "serializer.h"
#include "utils.h" #include "utils.h"
#include "optional.h" #include <optional.h>
#include "variant.h"
#include <rapidjson/writer.h> #include <rapidjson/writer.h>
#include <variant.h>
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
@ -15,9 +15,6 @@
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
using std::experimental::nullopt;
using std::experimental::optional;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -6,9 +6,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
using std::experimental::nullopt;
using std::experimental::optional;
struct Matcher { struct Matcher {
static optional<Matcher> Create(const std::string& search); static optional<Matcher> Create(const std::string& search);

View File

@ -6,9 +6,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
using std::experimental::nullopt;
using std::experimental::optional;
struct PlatformMutex { struct PlatformMutex {
virtual ~PlatformMutex(); virtual ~PlatformMutex();
}; };

View File

@ -10,9 +10,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
using std::experimental::nullopt;
using std::experimental::optional;
struct Project { struct Project {
struct Entry { struct Entry {
std::string filename; std::string filename;

View File

@ -3,12 +3,11 @@
#include "lru_cache.h" #include "lru_cache.h"
#include "query.h" #include "query.h"
#include <optional.h>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
using std::experimental::nullopt;
using std::experimental::optional;
// Caches symbols for a single file for semantic highlighting to provide // Caches symbols for a single file for semantic highlighting to provide
// relatively stable ids. Only supports xxx files at a time. // relatively stable ids. Only supports xxx files at a time.
struct SemanticHighlightSymbolCache { struct SemanticHighlightSymbolCache {

View File

@ -1,18 +1,15 @@
#pragma once #pragma once
#include <macro_map.h>
#include <optional.h>
#include <variant.h>
#include <rapidjson/document.h>
#include <rapidjson/prettywriter.h>
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "macro_map.h"
#include "optional.h"
#include "variant.h"
#include "rapidjson/document.h"
#include "rapidjson/prettywriter.h"
using std::experimental::nullopt;
using std::experimental::optional;
using Reader = rapidjson::GenericValue<rapidjson::UTF8<>>; using Reader = rapidjson::GenericValue<rapidjson::UTF8<>>;
using Writer = rapidjson::Writer<rapidjson::StringBuffer>; using Writer = rapidjson::Writer<rapidjson::StringBuffer>;
struct IndexFile; struct IndexFile;

View File

@ -9,9 +9,6 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
using std::experimental::optional;
using std::experimental::nullopt;
enum class TaskThread { enum class TaskThread {
Indexer, Indexer,
QueryDb, QueryDb,

View File

@ -11,9 +11,6 @@
#include <mutex> #include <mutex>
#include <queue> #include <queue>
using std::experimental::nullopt;
using std::experimental::optional;
// TODO: cleanup includes. // TODO: cleanup includes.
struct BaseThreadQueue { struct BaseThreadQueue {

View File

@ -5,9 +5,6 @@
#include <chrono> #include <chrono>
#include <string> #include <string>
using std::experimental::nullopt;
using std::experimental::optional;
struct Timer { struct Timer {
using Clock = std::chrono::high_resolution_clock; using Clock = std::chrono::high_resolution_clock;

View File

@ -7,9 +7,6 @@
#include <mutex> #include <mutex>
#include <unordered_map> #include <unordered_map>
using namespace std::experimental;
using std::experimental::nullopt;
// Caches timestamps of cc files so we can avoid a filesystem reads. This is // Caches timestamps of cc files so we can avoid a filesystem reads. This is
// important for import perf, as during dependency checking the same files are // important for import perf, as during dependency checking the same files are
// checked over and over again if they are common headers. // checked over and over again if they are common headers.

View File

@ -10,9 +10,6 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
using std::experimental::nullopt;
using std::experimental::optional;
// Trim from start (in place) // Trim from start (in place)
void TrimStartInPlace(std::string& s); void TrimStartInPlace(std::string& s);
// Trim from end (in place) // Trim from end (in place)

View File

@ -9,9 +9,6 @@
#include <mutex> #include <mutex>
#include <string> #include <string>
using std::experimental::nullopt;
using std::experimental::optional;
struct WorkingFile { struct WorkingFile {
int version = 0; int version = 0;
std::string filename; std::string filename;