mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-21 23:25:07 +00:00
Drop support for clang 6
This commit is contained in:
parent
f496580081
commit
c6d56519e3
@ -112,7 +112,7 @@ endif()
|
|||||||
### Libraries
|
### Libraries
|
||||||
|
|
||||||
# See cmake/FindClang.cmake
|
# See cmake/FindClang.cmake
|
||||||
find_package(Clang 6.0.0)
|
find_package(Clang 7.0.0)
|
||||||
target_link_libraries(ccls PRIVATE Clang::Clang)
|
target_link_libraries(ccls PRIVATE Clang::Clang)
|
||||||
|
|
||||||
# Enable threading support
|
# Enable threading support
|
||||||
|
@ -72,7 +72,6 @@ _Clang_find_library(Clang_LIBRARY clangIndex)
|
|||||||
_Clang_find_add_library(clangFormat)
|
_Clang_find_add_library(clangFormat)
|
||||||
_Clang_find_add_library(clangTooling)
|
_Clang_find_add_library(clangTooling)
|
||||||
|
|
||||||
# TODO Remove after dropping clang 6
|
|
||||||
_Clang_find_library(clangToolingInclusions_LIBRARY clangToolingInclusions)
|
_Clang_find_library(clangToolingInclusions_LIBRARY clangToolingInclusions)
|
||||||
if (clangToolingInclusions_LIBRARY)
|
if (clangToolingInclusions_LIBRARY)
|
||||||
list(APPEND _Clang_LIBRARIES ${clangToolingInclusions_LIBRARY})
|
list(APPEND _Clang_LIBRARIES ${clangToolingInclusions_LIBRARY})
|
||||||
|
@ -143,7 +143,6 @@ const char *ClangBuiltinTypeName(int kind) {
|
|||||||
return "double";
|
return "double";
|
||||||
case BuiltinType::LongDouble:
|
case BuiltinType::LongDouble:
|
||||||
return "long double";
|
return "long double";
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
|
||||||
case BuiltinType::ShortAccum:
|
case BuiltinType::ShortAccum:
|
||||||
return "short _Accum";
|
return "short _Accum";
|
||||||
case BuiltinType::Accum:
|
case BuiltinType::Accum:
|
||||||
@ -192,7 +191,6 @@ const char *ClangBuiltinTypeName(int kind) {
|
|||||||
return "_Sat unsigned _Fract";
|
return "_Sat unsigned _Fract";
|
||||||
case BuiltinType::BuiltinType::SatULongFract:
|
case BuiltinType::BuiltinType::SatULongFract:
|
||||||
return "_Sat unsigned long _Fract";
|
return "_Sat unsigned long _Fract";
|
||||||
#endif
|
|
||||||
case BuiltinType::Float16:
|
case BuiltinType::Float16:
|
||||||
return "_Float16";
|
return "_Float16";
|
||||||
case BuiltinType::Float128:
|
case BuiltinType::Float128:
|
||||||
@ -200,10 +198,8 @@ const char *ClangBuiltinTypeName(int kind) {
|
|||||||
case BuiltinType::WChar_S:
|
case BuiltinType::WChar_S:
|
||||||
case BuiltinType::WChar_U:
|
case BuiltinType::WChar_U:
|
||||||
return "wchar_t";
|
return "wchar_t";
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
|
||||||
case BuiltinType::Char8:
|
case BuiltinType::Char8:
|
||||||
return "char8_t";
|
return "char8_t";
|
||||||
#endif
|
|
||||||
case BuiltinType::Char16:
|
case BuiltinType::Char16:
|
||||||
return "char16_t";
|
return "char16_t";
|
||||||
case BuiltinType::Char32:
|
case BuiltinType::Char32:
|
||||||
|
@ -579,11 +579,7 @@ public:
|
|||||||
if (init) {
|
if (init) {
|
||||||
SourceManager &SM = Ctx->getSourceManager();
|
SourceManager &SM = Ctx->getSourceManager();
|
||||||
const LangOptions &Lang = Ctx->getLangOpts();
|
const LangOptions &Lang = Ctx->getLangOpts();
|
||||||
SourceRange R = SM.getExpansionRange(init->getSourceRange())
|
SourceRange R = SM.getExpansionRange(init->getSourceRange()).getAsRange();
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
|
||||||
.getAsRange()
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
SourceLocation L = D->getLocation();
|
SourceLocation L = D->getLocation();
|
||||||
if (L.isMacroID() || !SM.isBeforeInTranslationUnit(L, R.getBegin()))
|
if (L.isMacroID() || !SM.isBeforeInTranslationUnit(L, R.getBegin()))
|
||||||
return;
|
return;
|
||||||
@ -674,41 +670,15 @@ public:
|
|||||||
}
|
}
|
||||||
bool handleDeclOccurence(const Decl *D, index::SymbolRoleSet Roles,
|
bool handleDeclOccurence(const Decl *D, index::SymbolRoleSet Roles,
|
||||||
ArrayRef<index::SymbolRelation> Relations,
|
ArrayRef<index::SymbolRelation> Relations,
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
SourceLocation Loc, ASTNodeInfo ASTNode) override {
|
||||||
SourceLocation Loc,
|
|
||||||
#else
|
|
||||||
FileID LocFID, unsigned LocOffset,
|
|
||||||
#endif
|
|
||||||
ASTNodeInfo ASTNode) override {
|
|
||||||
SourceManager &SM = Ctx->getSourceManager();
|
SourceManager &SM = Ctx->getSourceManager();
|
||||||
const LangOptions &Lang = Ctx->getLangOpts();
|
const LangOptions &Lang = Ctx->getLangOpts();
|
||||||
#if LLVM_VERSION_MAJOR < 7
|
|
||||||
SourceLocation Loc;
|
|
||||||
{
|
|
||||||
const SrcMgr::SLocEntry &Entry = SM.getSLocEntry(LocFID);
|
|
||||||
unsigned off = Entry.getOffset() + LocOffset;
|
|
||||||
if (!Entry.isFile())
|
|
||||||
off |= 1u << 31;
|
|
||||||
Loc = SourceLocation::getFromRawEncoding(off);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
FileID LocFID;
|
FileID LocFID;
|
||||||
#endif
|
|
||||||
SourceLocation Spell = SM.getSpellingLoc(Loc);
|
SourceLocation Spell = SM.getSpellingLoc(Loc);
|
||||||
const FileEntry *FE;
|
const FileEntry *FE;
|
||||||
Range loc;
|
Range loc;
|
||||||
#if LLVM_VERSION_MAJOR < 7
|
|
||||||
CharSourceRange R;
|
|
||||||
if (SM.isMacroArgExpansion(Loc))
|
|
||||||
R = CharSourceRange::getTokenRange(Spell);
|
|
||||||
else {
|
|
||||||
auto P = SM.getExpansionRange(Loc);
|
|
||||||
R = CharSourceRange::getTokenRange(P.first, P.second);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
auto R = SM.isMacroArgExpansion(Loc) ? CharSourceRange::getTokenRange(Spell)
|
auto R = SM.isMacroArgExpansion(Loc) ? CharSourceRange::getTokenRange(Spell)
|
||||||
: SM.getExpansionRange(Loc);
|
: SM.getExpansionRange(Loc);
|
||||||
#endif
|
|
||||||
loc = FromCharSourceRange(SM, Lang, R);
|
loc = FromCharSourceRange(SM, Lang, R);
|
||||||
LocFID = SM.getFileID(R.getBegin());
|
LocFID = SM.getFileID(R.getBegin());
|
||||||
FE = SM.getFileEntryForID(LocFID);
|
FE = SM.getFileEntryForID(LocFID);
|
||||||
@ -1072,12 +1042,8 @@ public:
|
|||||||
StringRef Included, bool IsAngled,
|
StringRef Included, bool IsAngled,
|
||||||
CharSourceRange FilenameRange, const FileEntry *File,
|
CharSourceRange FilenameRange, const FileEntry *File,
|
||||||
StringRef SearchPath, StringRef RelativePath,
|
StringRef SearchPath, StringRef RelativePath,
|
||||||
const Module *Imported
|
const Module *Imported,
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
SrcMgr::CharacteristicKind FileType) override {
|
||||||
,
|
|
||||||
SrcMgr::CharacteristicKind FileType
|
|
||||||
#endif
|
|
||||||
) override {
|
|
||||||
if (!File)
|
if (!File)
|
||||||
return;
|
return;
|
||||||
llvm::sys::fs::UniqueID UniqueID;
|
llvm::sys::fs::UniqueID UniqueID;
|
||||||
@ -1260,9 +1226,7 @@ Index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs,
|
|||||||
IndexOpts.SystemSymbolFilter =
|
IndexOpts.SystemSymbolFilter =
|
||||||
index::IndexingOptions::SystemSymbolFilterKind::All;
|
index::IndexingOptions::SystemSymbolFilterKind::All;
|
||||||
IndexOpts.IndexFunctionLocals = true;
|
IndexOpts.IndexFunctionLocals = true;
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
|
||||||
IndexOpts.IndexImplicitInstantiation = true;
|
IndexOpts.IndexImplicitInstantiation = true;
|
||||||
#endif
|
|
||||||
|
|
||||||
std::unique_ptr<FrontendAction> Action = createIndexingAction(
|
std::unique_ptr<FrontendAction> Action = createIndexingAction(
|
||||||
DataConsumer, IndexOpts, std::make_unique<IndexFrontendAction>(param));
|
DataConsumer, IndexOpts, std::make_unique<IndexFrontendAction>(param));
|
||||||
|
@ -424,7 +424,6 @@ public:
|
|||||||
ls_items[j].label = ls_items[j].filterText;
|
ls_items[j].label = ls_items[j].filterText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
|
||||||
for (const FixItHint &FixIt : R.FixIts) {
|
for (const FixItHint &FixIt : R.FixIts) {
|
||||||
auto &AST = S.getASTContext();
|
auto &AST = S.getASTContext();
|
||||||
TextEdit ls_edit =
|
TextEdit ls_edit =
|
||||||
@ -432,7 +431,6 @@ public:
|
|||||||
for (size_t j = first_idx; j < ls_items.size(); j++)
|
for (size_t j = first_idx; j < ls_items.size(); j++)
|
||||||
ls_items[j].additionalTextEdits.push_back(ls_edit);
|
ls_items[j].additionalTextEdits.push_back(ls_edit);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,9 +460,7 @@ void MessageHandler::textDocument_completion(CompletionParam ¶m,
|
|||||||
clang::CodeCompleteOptions CCOpts;
|
clang::CodeCompleteOptions CCOpts;
|
||||||
CCOpts.IncludeBriefComments = true;
|
CCOpts.IncludeBriefComments = true;
|
||||||
CCOpts.IncludeCodePatterns = StringRef(buffer_line).ltrim().startswith("#");
|
CCOpts.IncludeCodePatterns = StringRef(buffer_line).ltrim().startswith("#");
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
|
||||||
CCOpts.IncludeFixIts = true;
|
CCOpts.IncludeFixIts = true;
|
||||||
#endif
|
|
||||||
CCOpts.IncludeMacros = true;
|
CCOpts.IncludeMacros = true;
|
||||||
|
|
||||||
if (param.context.triggerKind == CompletionTriggerKind::TriggerCharacter &&
|
if (param.context.triggerKind == CompletionTriggerKind::TriggerCharacter &&
|
||||||
|
@ -178,11 +178,8 @@ public:
|
|||||||
StringRef FileName, bool IsAngled,
|
StringRef FileName, bool IsAngled,
|
||||||
CharSourceRange FilenameRange, const FileEntry *File,
|
CharSourceRange FilenameRange, const FileEntry *File,
|
||||||
StringRef SearchPath, StringRef RelativePath,
|
StringRef SearchPath, StringRef RelativePath,
|
||||||
const clang::Module *Imported
|
const clang::Module *Imported,
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
SrcMgr::CharacteristicKind FileKind) override {
|
||||||
, SrcMgr::CharacteristicKind FileKind
|
|
||||||
#endif
|
|
||||||
) override {
|
|
||||||
(void)SM;
|
(void)SM;
|
||||||
if (File && Seen.insert(File).second)
|
if (File && Seen.insert(File).second)
|
||||||
out.emplace_back(PathFromFileEntry(*File), File->getModificationTime());
|
out.emplace_back(PathFromFileEntry(*File), File->getModificationTime());
|
||||||
@ -292,15 +289,10 @@ std::unique_ptr<CompilerInstance> BuildCompilerInstance(
|
|||||||
IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS, DiagnosticConsumer &DC,
|
IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS, DiagnosticConsumer &DC,
|
||||||
const PreambleData *preamble, const std::string &main,
|
const PreambleData *preamble, const std::string &main,
|
||||||
std::unique_ptr<llvm::MemoryBuffer> &Buf) {
|
std::unique_ptr<llvm::MemoryBuffer> &Buf) {
|
||||||
if (preamble) {
|
if (preamble)
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
|
||||||
preamble->Preamble.OverridePreamble(*CI, FS, Buf.get());
|
preamble->Preamble.OverridePreamble(*CI, FS, Buf.get());
|
||||||
#else
|
else
|
||||||
preamble->Preamble.AddImplicitPreamble(*CI, FS, Buf.get());
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
CI->getPreprocessorOpts().addRemappedFile(main, Buf.get());
|
CI->getPreprocessorOpts().addRemappedFile(main, Buf.get());
|
||||||
}
|
|
||||||
|
|
||||||
auto Clang = std::make_unique<CompilerInstance>(session.PCH);
|
auto Clang = std::make_unique<CompilerInstance>(session.PCH);
|
||||||
Clang->setInvocation(std::move(CI));
|
Clang->setInvocation(std::move(CI));
|
||||||
|
Loading…
Reference in New Issue
Block a user