mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
move optional to third_party
This commit is contained in:
parent
b6978b1a38
commit
38acb8c1a1
@ -1,5 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "utils.h"
|
||||
#include "serializer.h"
|
||||
#include "libclangmm/clangmm.h"
|
||||
#include "libclangmm/Utility.h"
|
||||
|
||||
#include <optional.h>
|
||||
#include <rapidjson/writer.h>
|
||||
#include <rapidjson/prettywriter.h>
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
#include <rapidjson/document.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <cstdint>
|
||||
@ -7,18 +18,6 @@
|
||||
#include <fstream>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "libclangmm/clangmm.h"
|
||||
#include "libclangmm/Utility.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "optional.h"
|
||||
#include "serializer.h"
|
||||
|
||||
#include <rapidjson/writer.h>
|
||||
#include <rapidjson/prettywriter.h>
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
#include <rapidjson/document.h>
|
||||
|
||||
struct IndexedTypeDef;
|
||||
struct IndexedFuncDef;
|
||||
struct IndexedVarDef;
|
||||
|
@ -1,15 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "serializer.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <optional.h>
|
||||
#include <rapidjson/writer.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <rapidjson/writer.h>
|
||||
#include "optional.h"
|
||||
#include "serializer.h"
|
||||
#include "utils.h"
|
||||
|
||||
using std::experimental::optional;
|
||||
using std::experimental::nullopt;
|
||||
|
||||
|
@ -31,10 +31,8 @@ TranslationUnit::TranslationUnit(Index &index, const std::string &file_path,
|
||||
TranslationUnit::TranslationUnit(Index &index, const std::string &file_path,
|
||||
const std::vector<std::string> &command_line_args, unsigned flags) {
|
||||
|
||||
// TODO: only push defines for the time being. Might need to pass more flags.
|
||||
std::vector<const char*> args;
|
||||
for (const std::string& a : command_line_args) {
|
||||
//if (a.size() >= 2 && a[0] == '-' && a[1] == 'D')
|
||||
args.push_back(a.c_str());
|
||||
}
|
||||
|
||||
|
1054
src/optional.h
1054
src/optional.h
File diff suppressed because it is too large
Load Diff
15
src/query.cc
15
src/query.cc
@ -1,5 +1,10 @@
|
||||
#include "query.h"
|
||||
|
||||
#include "compilation_database_loader.h"
|
||||
#include "indexer.h"
|
||||
|
||||
#include <optional.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <unordered_set>
|
||||
@ -7,13 +12,6 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include "compilation_database_loader.h"
|
||||
#include "optional.h"
|
||||
#include "indexer.h"
|
||||
|
||||
//#define CATCH_CONFIG_MAIN
|
||||
//#include "catch.hpp"
|
||||
|
||||
// TODO: Make all copy constructors explicit.
|
||||
|
||||
|
||||
@ -21,9 +19,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// NOTE: When not inside of a |def| object, there can be duplicates of the same
|
||||
// information if that information is contributed from separate sources.
|
||||
// If we need to avoid this duplication in the future, we will have to
|
||||
|
@ -1,11 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional.h>
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/prettywriter.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "optional.h"
|
||||
|
||||
using std::experimental::optional;
|
||||
using std::experimental::nullopt;
|
||||
|
@ -1,12 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// TODO: cleanup includes.
|
||||
#include <optional.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
#include "optional.h"
|
||||
// TODO: cleanup includes.
|
||||
|
||||
|
||||
// A threadsafe-queue. http://stackoverflow.com/a/16075550
|
||||
template <class T>
|
||||
@ -20,7 +22,7 @@ public:
|
||||
}
|
||||
|
||||
// Get the "front"-element.
|
||||
// If the queue is empty, wait till a element is avaiable.
|
||||
// If the queue is empty, wait untill an element is avaiable.
|
||||
T Dequeue() {
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
while (queue_.empty()) {
|
||||
@ -32,8 +34,8 @@ public:
|
||||
return val;
|
||||
}
|
||||
|
||||
// Get the "front"-element.
|
||||
// Returns empty if the queue is empty.
|
||||
// Get the first element from the queue without blocking. Returns a null
|
||||
// value if the queue is empty.
|
||||
optional<T> TryDequeue() {
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
if (queue_.empty())
|
||||
@ -44,7 +46,7 @@ public:
|
||||
return val;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
std::queue<T> queue_;
|
||||
mutable std::mutex mutex_;
|
||||
std::condition_variable cv_;
|
||||
|
Loading…
Reference in New Issue
Block a user