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
#include <optional.h>
#include <memory>
#include <string>
using std::experimental::nullopt;
using std::experimental::optional;
struct Config;
struct IndexFile;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,18 +1,15 @@
#pragma once
#include <macro_map.h>
#include <optional.h>
#include <variant.h>
#include <rapidjson/document.h>
#include <rapidjson/prettywriter.h>
#include <memory>
#include <string>
#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 Writer = rapidjson::Writer<rapidjson::StringBuffer>;
struct IndexFile;

View File

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

View File

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

View File

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

View File

@ -7,9 +7,6 @@
#include <mutex>
#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
// important for import perf, as during dependency checking the same files are
// checked over and over again if they are common headers.

View File

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

View File

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