mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-31 09:50:26 +00:00
Fix GCC __wur
This commit is contained in:
parent
3f4b727b4b
commit
40233104a6
@ -6,6 +6,7 @@
|
||||
#include "clang_utils.h"
|
||||
#include "file_consumer.h"
|
||||
#include "file_contents.h"
|
||||
#include "language.h"
|
||||
#include "language_server_api.h"
|
||||
#include "maybe.h"
|
||||
#include "nt_string.h"
|
||||
@ -32,6 +33,7 @@ struct IndexFile;
|
||||
struct IndexType;
|
||||
struct IndexFunc;
|
||||
struct IndexVar;
|
||||
struct QueryFile;
|
||||
|
||||
using RawId = uint32_t;
|
||||
|
||||
@ -81,8 +83,6 @@ using IndexTypeId = Id<IndexType>;
|
||||
using IndexFuncId = Id<IndexFunc>;
|
||||
using IndexVarId = Id<IndexVar>;
|
||||
|
||||
struct IdCache;
|
||||
|
||||
struct SymbolIdx {
|
||||
Id<void> id;
|
||||
SymbolKind kind;
|
||||
@ -130,8 +130,6 @@ struct SymbolRef : Reference {
|
||||
: Reference{Range(), si.id, si.kind, Role::None} {}
|
||||
};
|
||||
|
||||
struct QueryFile;
|
||||
|
||||
// Represents an occurrence of a variable/type, |id,kind| refer to the lexical
|
||||
// parent.
|
||||
struct Use : Reference {
|
||||
@ -380,7 +378,6 @@ struct VarDefDefinitionData {
|
||||
bool is_local() const {
|
||||
return kind == lsSymbolKind::Variable;
|
||||
}
|
||||
bool is_macro() const { return kind == lsSymbolKind::Macro; }
|
||||
|
||||
bool operator==(const VarDefDefinitionData& o) const {
|
||||
return detailed_name == o.detailed_name && spell == o.spell &&
|
||||
@ -422,7 +419,6 @@ struct IndexVar {
|
||||
Def def;
|
||||
|
||||
std::vector<Use> declarations;
|
||||
// Usages.
|
||||
std::vector<Use> uses;
|
||||
|
||||
IndexVar() {} // For serialization.
|
||||
@ -452,12 +448,6 @@ struct IndexInclude {
|
||||
std::string resolved_path;
|
||||
};
|
||||
|
||||
// Used to identify the language at a file level. The ordering is important, as
|
||||
// a file previously identified as `C`, will be changed to `Cpp` if it
|
||||
// encounters a c++ declaration.
|
||||
enum class LanguageId { Unknown = 0, C = 1, Cpp = 2, ObjC = 3, ObjCpp = 4 };
|
||||
MAKE_REFLECT_TYPE_PROXY(LanguageId);
|
||||
|
||||
struct IndexFile {
|
||||
IdCache id_cache;
|
||||
|
||||
|
9
src/language.h
Normal file
9
src/language.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "serializer.h"
|
||||
|
||||
// Used to identify the language at a file level. The ordering is important, as
|
||||
// a file previously identified as `C`, will be changed to `Cpp` if it
|
||||
// encounters a c++ declaration.
|
||||
enum class LanguageId { Unknown = 0, C = 1, Cpp = 2, ObjC = 3, ObjCpp = 4 };
|
||||
MAKE_REFLECT_TYPE_PROXY(LanguageId);
|
@ -252,7 +252,7 @@ struct TextDocumentCodeLensHandler
|
||||
bool force_display = true;
|
||||
// Do not show 0 refs on macro with no uses, as it is most likely
|
||||
// a header guard.
|
||||
if (def->is_macro())
|
||||
if (def->kind == lsSymbolKind::Macro)
|
||||
force_display = false;
|
||||
|
||||
AddCodeLens("ref", "refs", &common, OffsetStartColumn(use, 0),
|
||||
|
@ -313,7 +313,8 @@ std::string GetExternalCommandOutput(const std::vector<std::string>& command,
|
||||
}
|
||||
close(pin[1]);
|
||||
close(pout[0]);
|
||||
write(pout[1], input.data(), input.size());
|
||||
// O_NONBLOCK is disabled, write(2) blocks until all bytes are written.
|
||||
(void)write(pout[1], input.data(), input.size());
|
||||
close(pout[1]);
|
||||
std::string ret;
|
||||
char buf[4096];
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "project.h"
|
||||
|
||||
#include "clang_utils.h"
|
||||
#include "language.h"
|
||||
#include "match.h"
|
||||
#include "platform.h"
|
||||
#include "serializer.h"
|
||||
@ -100,9 +101,6 @@ bool ShouldAddToAngleIncludes(const std::string& arg) {
|
||||
return StartsWithAny(arg, kAngleIncludeArgs);
|
||||
}
|
||||
|
||||
// FIXME
|
||||
enum class LanguageId { Unknown = 0, C = 1, Cpp = 2, ObjC = 3, ObjCpp = 4 };
|
||||
|
||||
LanguageId SourceFileLanguage(const std::string& path) {
|
||||
if (EndsWith(path, ".c"))
|
||||
return LanguageId::C;
|
||||
|
Loading…
Reference in New Issue
Block a user