mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-30 11:27:07 +00:00
Remove clang_utils.*
This commit is contained in:
parent
395e9d8724
commit
35cba6d49c
@ -181,7 +181,6 @@ target_sources(ccls PRIVATE third_party/siphash.cc)
|
|||||||
target_sources(ccls PRIVATE
|
target_sources(ccls PRIVATE
|
||||||
src/clang_complete.cc
|
src/clang_complete.cc
|
||||||
src/clang_tu.cc
|
src/clang_tu.cc
|
||||||
src/clang_utils.cc
|
|
||||||
src/config.cc
|
src/config.cc
|
||||||
src/filesystem.cc
|
src/filesystem.cc
|
||||||
src/fuzzy_match.cc
|
src/fuzzy_match.cc
|
||||||
|
@ -3,13 +3,12 @@
|
|||||||
|
|
||||||
#include "clang_complete.hh"
|
#include "clang_complete.hh"
|
||||||
|
|
||||||
#include "clang_utils.h"
|
#include "clang_tu.hh"
|
||||||
#include "filesystem.hh"
|
#include "filesystem.hh"
|
||||||
#include "log.hh"
|
#include "log.hh"
|
||||||
#include "match.h"
|
#include "match.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
#include <clang/Frontend/CompilerInstance.h>
|
|
||||||
#include <clang/Lex/PreprocessorOptions.h>
|
#include <clang/Lex/PreprocessorOptions.h>
|
||||||
#include <clang/Sema/CodeCompleteConsumer.h>
|
#include <clang/Sema/CodeCompleteConsumer.h>
|
||||||
#include <clang/Sema/Sema.h>
|
#include <clang/Sema/Sema.h>
|
||||||
@ -96,7 +95,7 @@ public:
|
|||||||
auto it = FID2concerned.try_emplace(FID.getHashValue());
|
auto it = FID2concerned.try_emplace(FID.getHashValue());
|
||||||
if (it.second) {
|
if (it.second) {
|
||||||
const FileEntry *FE = SM.getFileEntryForID(FID);
|
const FileEntry *FE = SM.getFileEntryForID(FID);
|
||||||
it.first->second = FE && FileName(*FE) == path;
|
it.first->second = FE && PathFromFileEntry(*FE) == path;
|
||||||
}
|
}
|
||||||
return it.first->second;
|
return it.first->second;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clang_tu.h"
|
#include "clang_tu.hh"
|
||||||
#include "lru_cache.h"
|
#include "lru_cache.h"
|
||||||
#include "lsp_completion.h"
|
#include "lsp_completion.h"
|
||||||
#include "lsp_diagnostic.h"
|
#include "lsp_diagnostic.h"
|
||||||
|
170
src/clang_tu.cc
170
src/clang_tu.cc
@ -1,16 +1,32 @@
|
|||||||
// Copyright 2017-2018 ccls Authors
|
// Copyright 2017-2018 ccls Authors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
#include "clang_tu.h"
|
#include "clang_tu.hh"
|
||||||
|
|
||||||
#include "clang_utils.h"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include <clang/AST/Type.h>
|
||||||
#include <clang/Lex/Lexer.h>
|
#include <clang/Lex/Lexer.h>
|
||||||
|
#include <llvm/Support/Path.h>
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
#include <assert.h>
|
std::string PathFromFileEntry(const FileEntry &file) {
|
||||||
#include <mutex>
|
StringRef Name = file.tryGetRealPathName();
|
||||||
|
if (Name.empty())
|
||||||
|
Name = file.getName();
|
||||||
|
std::string ret = NormalizePath(Name);
|
||||||
|
// Resolve /usr/include/c++/7.3.0 symlink.
|
||||||
|
if (!StartsWith(ret, g_config->projectRoot)) {
|
||||||
|
SmallString<256> dest;
|
||||||
|
llvm::sys::fs::real_path(ret, dest);
|
||||||
|
ret = llvm::sys::path::convert_to_slash(dest.str());
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
Range FromCharSourceRange(const SourceManager &SM, const LangOptions &LangOpts,
|
Range FromCharSourceRange(const SourceManager &SM, const LangOptions &LangOpts,
|
||||||
CharSourceRange R,
|
CharSourceRange R,
|
||||||
@ -69,3 +85,149 @@ BuildCompilerInvocation(std::vector<const char *> args,
|
|||||||
}
|
}
|
||||||
return CI;
|
return CI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clang::BuiltinType::getName without PrintingPolicy
|
||||||
|
const char *ClangBuiltinTypeName(int kind) {
|
||||||
|
switch (BuiltinType::Kind(kind)) {
|
||||||
|
case BuiltinType::Void:
|
||||||
|
return "void";
|
||||||
|
case BuiltinType::Bool:
|
||||||
|
return "bool";
|
||||||
|
case BuiltinType::Char_S:
|
||||||
|
case BuiltinType::Char_U:
|
||||||
|
return "char";
|
||||||
|
case BuiltinType::SChar:
|
||||||
|
return "signed char";
|
||||||
|
case BuiltinType::Short:
|
||||||
|
return "short";
|
||||||
|
case BuiltinType::Int:
|
||||||
|
return "int";
|
||||||
|
case BuiltinType::Long:
|
||||||
|
return "long";
|
||||||
|
case BuiltinType::LongLong:
|
||||||
|
return "long long";
|
||||||
|
case BuiltinType::Int128:
|
||||||
|
return "__int128";
|
||||||
|
case BuiltinType::UChar:
|
||||||
|
return "unsigned char";
|
||||||
|
case BuiltinType::UShort:
|
||||||
|
return "unsigned short";
|
||||||
|
case BuiltinType::UInt:
|
||||||
|
return "unsigned int";
|
||||||
|
case BuiltinType::ULong:
|
||||||
|
return "unsigned long";
|
||||||
|
case BuiltinType::ULongLong:
|
||||||
|
return "unsigned long long";
|
||||||
|
case BuiltinType::UInt128:
|
||||||
|
return "unsigned __int128";
|
||||||
|
case BuiltinType::Half:
|
||||||
|
return "__fp16";
|
||||||
|
case BuiltinType::Float:
|
||||||
|
return "float";
|
||||||
|
case BuiltinType::Double:
|
||||||
|
return "double";
|
||||||
|
case BuiltinType::LongDouble:
|
||||||
|
return "long double";
|
||||||
|
#if LLVM_VERSION_MAJOR >= 7
|
||||||
|
case BuiltinType::ShortAccum:
|
||||||
|
return "short _Accum";
|
||||||
|
case BuiltinType::Accum:
|
||||||
|
return "_Accum";
|
||||||
|
case BuiltinType::LongAccum:
|
||||||
|
return "long _Accum";
|
||||||
|
case BuiltinType::UShortAccum:
|
||||||
|
return "unsigned short _Accum";
|
||||||
|
case BuiltinType::UAccum:
|
||||||
|
return "unsigned _Accum";
|
||||||
|
case BuiltinType::ULongAccum:
|
||||||
|
return "unsigned long _Accum";
|
||||||
|
case BuiltinType::BuiltinType::ShortFract:
|
||||||
|
return "short _Fract";
|
||||||
|
case BuiltinType::BuiltinType::Fract:
|
||||||
|
return "_Fract";
|
||||||
|
case BuiltinType::BuiltinType::LongFract:
|
||||||
|
return "long _Fract";
|
||||||
|
case BuiltinType::BuiltinType::UShortFract:
|
||||||
|
return "unsigned short _Fract";
|
||||||
|
case BuiltinType::BuiltinType::UFract:
|
||||||
|
return "unsigned _Fract";
|
||||||
|
case BuiltinType::BuiltinType::ULongFract:
|
||||||
|
return "unsigned long _Fract";
|
||||||
|
case BuiltinType::BuiltinType::SatShortAccum:
|
||||||
|
return "_Sat short _Accum";
|
||||||
|
case BuiltinType::BuiltinType::SatAccum:
|
||||||
|
return "_Sat _Accum";
|
||||||
|
case BuiltinType::BuiltinType::SatLongAccum:
|
||||||
|
return "_Sat long _Accum";
|
||||||
|
case BuiltinType::BuiltinType::SatUShortAccum:
|
||||||
|
return "_Sat unsigned short _Accum";
|
||||||
|
case BuiltinType::BuiltinType::SatUAccum:
|
||||||
|
return "_Sat unsigned _Accum";
|
||||||
|
case BuiltinType::BuiltinType::SatULongAccum:
|
||||||
|
return "_Sat unsigned long _Accum";
|
||||||
|
case BuiltinType::BuiltinType::SatShortFract:
|
||||||
|
return "_Sat short _Fract";
|
||||||
|
case BuiltinType::BuiltinType::SatFract:
|
||||||
|
return "_Sat _Fract";
|
||||||
|
case BuiltinType::BuiltinType::SatLongFract:
|
||||||
|
return "_Sat long _Fract";
|
||||||
|
case BuiltinType::BuiltinType::SatUShortFract:
|
||||||
|
return "_Sat unsigned short _Fract";
|
||||||
|
case BuiltinType::BuiltinType::SatUFract:
|
||||||
|
return "_Sat unsigned _Fract";
|
||||||
|
case BuiltinType::BuiltinType::SatULongFract:
|
||||||
|
return "_Sat unsigned long _Fract";
|
||||||
|
#endif
|
||||||
|
case BuiltinType::Float16:
|
||||||
|
return "_Float16";
|
||||||
|
case BuiltinType::Float128:
|
||||||
|
return "__float128";
|
||||||
|
case BuiltinType::WChar_S:
|
||||||
|
case BuiltinType::WChar_U:
|
||||||
|
return "wchar_t";
|
||||||
|
#if LLVM_VERSION_MAJOR >= 7
|
||||||
|
case BuiltinType::Char8:
|
||||||
|
return "char8_t";
|
||||||
|
#endif
|
||||||
|
case BuiltinType::Char16:
|
||||||
|
return "char16_t";
|
||||||
|
case BuiltinType::Char32:
|
||||||
|
return "char32_t";
|
||||||
|
case BuiltinType::NullPtr:
|
||||||
|
return "nullptr_t";
|
||||||
|
case BuiltinType::Overload:
|
||||||
|
return "<overloaded function type>";
|
||||||
|
case BuiltinType::BoundMember:
|
||||||
|
return "<bound member function type>";
|
||||||
|
case BuiltinType::PseudoObject:
|
||||||
|
return "<pseudo-object type>";
|
||||||
|
case BuiltinType::Dependent:
|
||||||
|
return "<dependent type>";
|
||||||
|
case BuiltinType::UnknownAny:
|
||||||
|
return "<unknown type>";
|
||||||
|
case BuiltinType::ARCUnbridgedCast:
|
||||||
|
return "<ARC unbridged cast type>";
|
||||||
|
case BuiltinType::BuiltinFn:
|
||||||
|
return "<builtin fn type>";
|
||||||
|
case BuiltinType::ObjCId:
|
||||||
|
return "id";
|
||||||
|
case BuiltinType::ObjCClass:
|
||||||
|
return "Class";
|
||||||
|
case BuiltinType::ObjCSel:
|
||||||
|
return "SEL";
|
||||||
|
case BuiltinType::OCLSampler:
|
||||||
|
return "sampler_t";
|
||||||
|
case BuiltinType::OCLEvent:
|
||||||
|
return "event_t";
|
||||||
|
case BuiltinType::OCLClkEvent:
|
||||||
|
return "clk_event_t";
|
||||||
|
case BuiltinType::OCLQueue:
|
||||||
|
return "queue_t";
|
||||||
|
case BuiltinType::OCLReserveID:
|
||||||
|
return "reserve_id_t";
|
||||||
|
case BuiltinType::OMPArraySection:
|
||||||
|
return "<OpenMP array section type>";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2,13 +2,15 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "position.h"
|
#include "position.h"
|
||||||
|
|
||||||
#include <clang/Basic/LangOptions.h>
|
#include <clang/Basic/LangOptions.h>
|
||||||
|
#include <clang/Basic/FileManager.h>
|
||||||
#include <clang/Basic/SourceManager.h>
|
#include <clang/Basic/SourceManager.h>
|
||||||
#include <clang/Frontend/CompilerInstance.h>
|
#include <clang/Frontend/CompilerInstance.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
std::string PathFromFileEntry(const clang::FileEntry &file);
|
||||||
|
|
||||||
Range FromCharSourceRange(const clang::SourceManager &SM,
|
Range FromCharSourceRange(const clang::SourceManager &SM,
|
||||||
const clang::LangOptions &LangOpts,
|
const clang::LangOptions &LangOpts,
|
||||||
@ -26,3 +28,5 @@ Range FromTokenRange(const clang::SourceManager &SM,
|
|||||||
std::unique_ptr<clang::CompilerInvocation>
|
std::unique_ptr<clang::CompilerInvocation>
|
||||||
BuildCompilerInvocation(std::vector<const char *> args,
|
BuildCompilerInvocation(std::vector<const char *> args,
|
||||||
llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> VFS);
|
llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> VFS);
|
||||||
|
|
||||||
|
const char *ClangBuiltinTypeName(int);
|
@ -1,175 +0,0 @@
|
|||||||
// Copyright 2017-2018 ccls Authors
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
#include "clang_utils.h"
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "filesystem.hh"
|
|
||||||
#include "platform.h"
|
|
||||||
#include "utils.h"
|
|
||||||
|
|
||||||
#include <clang/AST/Type.h>
|
|
||||||
#include <llvm/Config/llvm-config.h>
|
|
||||||
using namespace clang;
|
|
||||||
using namespace llvm;
|
|
||||||
|
|
||||||
std::string FileName(const FileEntry &file) {
|
|
||||||
StringRef Name = file.tryGetRealPathName();
|
|
||||||
if (Name.empty())
|
|
||||||
Name = file.getName();
|
|
||||||
std::string ret = NormalizePath(Name);
|
|
||||||
// Resolve /usr/include/c++/7.3.0 symlink.
|
|
||||||
if (!StartsWith(ret, g_config->projectRoot)) {
|
|
||||||
SmallString<256> dest;
|
|
||||||
sys::fs::real_path(ret, dest);
|
|
||||||
ret = sys::path::convert_to_slash(dest.str());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// clang::BuiltinType::getName without PrintingPolicy
|
|
||||||
const char *ClangBuiltinTypeName(int kind) {
|
|
||||||
switch (BuiltinType::Kind(kind)) {
|
|
||||||
case BuiltinType::Void:
|
|
||||||
return "void";
|
|
||||||
case BuiltinType::Bool:
|
|
||||||
return "bool";
|
|
||||||
case BuiltinType::Char_S:
|
|
||||||
return "char";
|
|
||||||
case BuiltinType::Char_U:
|
|
||||||
return "char";
|
|
||||||
case BuiltinType::SChar:
|
|
||||||
return "signed char";
|
|
||||||
case BuiltinType::Short:
|
|
||||||
return "short";
|
|
||||||
case BuiltinType::Int:
|
|
||||||
return "int";
|
|
||||||
case BuiltinType::Long:
|
|
||||||
return "long";
|
|
||||||
case BuiltinType::LongLong:
|
|
||||||
return "long long";
|
|
||||||
case BuiltinType::Int128:
|
|
||||||
return "__int128";
|
|
||||||
case BuiltinType::UChar:
|
|
||||||
return "unsigned char";
|
|
||||||
case BuiltinType::UShort:
|
|
||||||
return "unsigned short";
|
|
||||||
case BuiltinType::UInt:
|
|
||||||
return "unsigned int";
|
|
||||||
case BuiltinType::ULong:
|
|
||||||
return "unsigned long";
|
|
||||||
case BuiltinType::ULongLong:
|
|
||||||
return "unsigned long long";
|
|
||||||
case BuiltinType::UInt128:
|
|
||||||
return "unsigned __int128";
|
|
||||||
case BuiltinType::Half:
|
|
||||||
return "__fp16";
|
|
||||||
case BuiltinType::Float:
|
|
||||||
return "float";
|
|
||||||
case BuiltinType::Double:
|
|
||||||
return "double";
|
|
||||||
case BuiltinType::LongDouble:
|
|
||||||
return "long double";
|
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
|
||||||
case BuiltinType::ShortAccum:
|
|
||||||
return "short _Accum";
|
|
||||||
case BuiltinType::Accum:
|
|
||||||
return "_Accum";
|
|
||||||
case BuiltinType::LongAccum:
|
|
||||||
return "long _Accum";
|
|
||||||
case BuiltinType::UShortAccum:
|
|
||||||
return "unsigned short _Accum";
|
|
||||||
case BuiltinType::UAccum:
|
|
||||||
return "unsigned _Accum";
|
|
||||||
case BuiltinType::ULongAccum:
|
|
||||||
return "unsigned long _Accum";
|
|
||||||
case BuiltinType::BuiltinType::ShortFract:
|
|
||||||
return "short _Fract";
|
|
||||||
case BuiltinType::BuiltinType::Fract:
|
|
||||||
return "_Fract";
|
|
||||||
case BuiltinType::BuiltinType::LongFract:
|
|
||||||
return "long _Fract";
|
|
||||||
case BuiltinType::BuiltinType::UShortFract:
|
|
||||||
return "unsigned short _Fract";
|
|
||||||
case BuiltinType::BuiltinType::UFract:
|
|
||||||
return "unsigned _Fract";
|
|
||||||
case BuiltinType::BuiltinType::ULongFract:
|
|
||||||
return "unsigned long _Fract";
|
|
||||||
case BuiltinType::BuiltinType::SatShortAccum:
|
|
||||||
return "_Sat short _Accum";
|
|
||||||
case BuiltinType::BuiltinType::SatAccum:
|
|
||||||
return "_Sat _Accum";
|
|
||||||
case BuiltinType::BuiltinType::SatLongAccum:
|
|
||||||
return "_Sat long _Accum";
|
|
||||||
case BuiltinType::BuiltinType::SatUShortAccum:
|
|
||||||
return "_Sat unsigned short _Accum";
|
|
||||||
case BuiltinType::BuiltinType::SatUAccum:
|
|
||||||
return "_Sat unsigned _Accum";
|
|
||||||
case BuiltinType::BuiltinType::SatULongAccum:
|
|
||||||
return "_Sat unsigned long _Accum";
|
|
||||||
case BuiltinType::BuiltinType::SatShortFract:
|
|
||||||
return "_Sat short _Fract";
|
|
||||||
case BuiltinType::BuiltinType::SatFract:
|
|
||||||
return "_Sat _Fract";
|
|
||||||
case BuiltinType::BuiltinType::SatLongFract:
|
|
||||||
return "_Sat long _Fract";
|
|
||||||
case BuiltinType::BuiltinType::SatUShortFract:
|
|
||||||
return "_Sat unsigned short _Fract";
|
|
||||||
case BuiltinType::BuiltinType::SatUFract:
|
|
||||||
return "_Sat unsigned _Fract";
|
|
||||||
case BuiltinType::BuiltinType::SatULongFract:
|
|
||||||
return "_Sat unsigned long _Fract";
|
|
||||||
#endif
|
|
||||||
case BuiltinType::Float16:
|
|
||||||
return "_Float16";
|
|
||||||
case BuiltinType::Float128:
|
|
||||||
return "__float128";
|
|
||||||
case BuiltinType::WChar_S:
|
|
||||||
case BuiltinType::WChar_U:
|
|
||||||
return "wchar_t";
|
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
|
||||||
case BuiltinType::Char8:
|
|
||||||
return "char8_t";
|
|
||||||
#endif
|
|
||||||
case BuiltinType::Char16:
|
|
||||||
return "char16_t";
|
|
||||||
case BuiltinType::Char32:
|
|
||||||
return "char32_t";
|
|
||||||
case BuiltinType::NullPtr:
|
|
||||||
return "nullptr_t";
|
|
||||||
case BuiltinType::Overload:
|
|
||||||
return "<overloaded function type>";
|
|
||||||
case BuiltinType::BoundMember:
|
|
||||||
return "<bound member function type>";
|
|
||||||
case BuiltinType::PseudoObject:
|
|
||||||
return "<pseudo-object type>";
|
|
||||||
case BuiltinType::Dependent:
|
|
||||||
return "<dependent type>";
|
|
||||||
case BuiltinType::UnknownAny:
|
|
||||||
return "<unknown type>";
|
|
||||||
case BuiltinType::ARCUnbridgedCast:
|
|
||||||
return "<ARC unbridged cast type>";
|
|
||||||
case BuiltinType::BuiltinFn:
|
|
||||||
return "<builtin fn type>";
|
|
||||||
case BuiltinType::ObjCId:
|
|
||||||
return "id";
|
|
||||||
case BuiltinType::ObjCClass:
|
|
||||||
return "Class";
|
|
||||||
case BuiltinType::ObjCSel:
|
|
||||||
return "SEL";
|
|
||||||
case BuiltinType::OCLSampler:
|
|
||||||
return "sampler_t";
|
|
||||||
case BuiltinType::OCLEvent:
|
|
||||||
return "event_t";
|
|
||||||
case BuiltinType::OCLClkEvent:
|
|
||||||
return "clk_event_t";
|
|
||||||
case BuiltinType::OCLQueue:
|
|
||||||
return "queue_t";
|
|
||||||
case BuiltinType::OCLReserveID:
|
|
||||||
return "reserve_id_t";
|
|
||||||
case BuiltinType::OMPArraySection:
|
|
||||||
return "<OpenMP array section type>";
|
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright 2017-2018 ccls Authors
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <clang/Basic/FileManager.h>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
// Returns the absolute path to |file|.
|
|
||||||
std::string FileName(const clang::FileEntry &file);
|
|
||||||
|
|
||||||
const char *ClangBuiltinTypeName(int);
|
|
@ -4,7 +4,7 @@
|
|||||||
#include "indexer.h"
|
#include "indexer.h"
|
||||||
|
|
||||||
#include "clang_complete.hh"
|
#include "clang_complete.hh"
|
||||||
#include "clang_tu.h"
|
#include "clang_tu.hh"
|
||||||
#include "log.hh"
|
#include "log.hh"
|
||||||
#include "match.h"
|
#include "match.h"
|
||||||
#include "pipeline.hh"
|
#include "pipeline.hh"
|
||||||
@ -61,7 +61,7 @@ struct IndexParam {
|
|||||||
// generating an index for it):
|
// generating an index for it):
|
||||||
auto [it, inserted] = UID2File.try_emplace(File.getUniqueID());
|
auto [it, inserted] = UID2File.try_emplace(File.getUniqueID());
|
||||||
if (inserted) {
|
if (inserted) {
|
||||||
std::string path = FileName(File);
|
std::string path = PathFromFileEntry(File);
|
||||||
it->second.path = path;
|
it->second.path = path;
|
||||||
it->second.mtime = File.getModificationTime();
|
it->second.mtime = File.getModificationTime();
|
||||||
if (!it->second.mtime)
|
if (!it->second.mtime)
|
||||||
@ -85,7 +85,7 @@ struct IndexParam {
|
|||||||
bool UseMultiVersion(const FileEntry &FE) {
|
bool UseMultiVersion(const FileEntry &FE) {
|
||||||
auto it = UID2multi.try_emplace(FE.getUniqueID());
|
auto it = UID2multi.try_emplace(FE.getUniqueID());
|
||||||
if (it.second)
|
if (it.second)
|
||||||
it.first->second = multiVersionMatcher->IsMatch(FileName(FE));
|
it.first->second = multiVersionMatcher->IsMatch(PathFromFileEntry(FE));
|
||||||
return it.first->second;
|
return it.first->second;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1084,9 +1084,9 @@ public:
|
|||||||
if (!FE)
|
if (!FE)
|
||||||
return;
|
return;
|
||||||
if (IndexFile *db = param.ConsumeFile(*FE)) {
|
if (IndexFile *db = param.ConsumeFile(*FE)) {
|
||||||
std::string file_name = FileName(*File);
|
std::string path = PathFromFileEntry(*File);
|
||||||
if (file_name.size())
|
if (path.size())
|
||||||
db->includes.push_back({spell.start.line, Intern(file_name)});
|
db->includes.push_back({spell.start.line, Intern(path)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void MacroDefined(const Token &Tok, const MacroDirective *MD) override {
|
void MacroDefined(const Token &Tok, const MacroDirective *MD) override {
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clang_utils.h"
|
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "lsp.h"
|
#include "lsp.h"
|
||||||
#include "lsp_diagnostic.h"
|
#include "lsp_diagnostic.h"
|
||||||
@ -13,6 +12,7 @@
|
|||||||
#include "symbol.h"
|
#include "symbol.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include <clang/Basic/FileManager.h>
|
||||||
#include <clang/Basic/Specifiers.h>
|
#include <clang/Basic/Specifiers.h>
|
||||||
#include <llvm/ADT/CachedHashString.h>
|
#include <llvm/ADT/CachedHashString.h>
|
||||||
#include <llvm/ADT/DenseMap.h>
|
#include <llvm/ADT/DenseMap.h>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright 2017-2018 ccls Authors
|
// Copyright 2017-2018 ccls Authors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
#include "clang_tu.hh"
|
||||||
#include "hierarchy.hh"
|
#include "hierarchy.hh"
|
||||||
#include "message_handler.h"
|
#include "message_handler.h"
|
||||||
#include "pipeline.hh"
|
#include "pipeline.hh"
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
|
||||||
#include "clang_utils.h"
|
|
||||||
#include "filesystem.hh"
|
#include "filesystem.hh"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "log.hh"
|
#include "log.hh"
|
||||||
|
Loading…
Reference in New Issue
Block a user