Skip to content

Commit 50fd8d0

Browse files
committed
Drop support for LLVM 7, 8, and 9
1 parent 192a82b commit 50fd8d0

14 files changed

+4
-540
lines changed

CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ target_sources(ccls PRIVATE
201201
src/filesystem.cc
202202
src/fuzzy_match.cc
203203
src/main.cc
204-
src/include_complete.cc
205204
src/indexer.cc
206205
src/log.cc
207206
src/lsp.cc

src/clang_tu.cc

-7
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,7 @@ buildCompilerInvocation(const std::string &main, std::vector<const char *> args,
163163
return nullptr;
164164
const llvm::opt::ArgStringList &cc_args = cmd.getArguments();
165165
auto ci = std::make_unique<CompilerInvocation>();
166-
#if LLVM_VERSION_MAJOR >= 10 // rC370122
167166
if (!CompilerInvocation::CreateFromArgs(*ci, cc_args, *diags))
168-
#else
169-
if (!CompilerInvocation::CreateFromArgs(
170-
*ci, cc_args.data(), cc_args.data() + cc_args.size(), *diags))
171-
#endif
172167
return nullptr;
173168

174169
ci->getDiagnosticOpts().IgnoreWarnings = true;
@@ -189,9 +184,7 @@ buildCompilerInvocation(const std::string &main, std::vector<const char *> args,
189184
auto &isec = ci->getFrontendOpts().Inputs;
190185
if (isec.size())
191186
isec[0] = FrontendInputFile(main, isec[0].getKind(), isec[0].isSystem());
192-
#if LLVM_VERSION_MAJOR >= 10 // llvmorg-11-init-2414-g75f09b54429
193187
ci->getPreprocessorOpts().DisablePragmaDebugCrash = true;
194-
#endif
195188
// clangSerialization has an unstable format. Disable PCH reading/writing
196189
// to work around PCH mismatch problems.
197190
ci->getPreprocessorOpts().ImplicitPCHInclude.clear();

src/clang_tu.hh

-7
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@
1010
#include <clang/Basic/SourceManager.h>
1111
#include <clang/Frontend/CompilerInstance.h>
1212

13-
#if LLVM_VERSION_MAJOR < 8
14-
// D52783 Lift VFS from clang to llvm
15-
namespace llvm {
16-
namespace vfs = clang::vfs;
17-
}
18-
#endif
19-
2013
#if LLVM_VERSION_MAJOR < 14 // llvmorg-14-init-3863-g601102d282d5
2114
#define isAsciiIdentifierContinue isIdentifierBody
2215
#endif

src/include_complete.cc

-185
This file was deleted.

src/include_complete.hh

-49
This file was deleted.

src/indexer.cc

-51
Original file line numberDiff line numberDiff line change
@@ -710,9 +710,6 @@ class IndexDataConsumer : public index::IndexDataConsumer {
710710
public:
711711
IndexDataConsumer(IndexParam &param) : param(param) {}
712712
void initialize(ASTContext &ctx) override { this->ctx = param.ctx = &ctx; }
713-
#if LLVM_VERSION_MAJOR < 10 // llvmorg-10-init-12036-g3b9715cb219
714-
# define handleDeclOccurrence handleDeclOccurence
715-
#endif
716713
bool handleDeclOccurrence(const Decl *d, index::SymbolRoleSet roles,
717714
ArrayRef<index::SymbolRelation> relations,
718715
SourceLocation src_loc,
@@ -899,31 +896,6 @@ class IndexDataConsumer : public index::IndexDataConsumer {
899896
if (!isa<EnumConstantDecl>(d))
900897
db->toType(usr1).instances.push_back(usr);
901898
} else if (const Decl *d1 = getAdjustedDecl(getTypeDecl(t))) {
902-
#if LLVM_VERSION_MAJOR < 9
903-
if (isa<TemplateTypeParmDecl>(d1)) {
904-
// e.g. TemplateTypeParmDecl is not handled by
905-
// handleDeclOccurence.
906-
SourceRange sr1 = d1->getSourceRange();
907-
if (sm.getFileID(sr1.getBegin()) == fid) {
908-
IndexParam::DeclInfo *info1;
909-
Usr usr1 = getUsr(d1, &info1);
910-
IndexType &type1 = db->toType(usr1);
911-
SourceLocation sl1 = d1->getLocation();
912-
type1.def.spell = {
913-
Use{{fromTokenRange(sm, lang, {sl1, sl1}), Role::Definition},
914-
lid},
915-
fromTokenRange(sm, lang, sr1)};
916-
type1.def.detailed_name = intern(info1->short_name);
917-
type1.def.short_name_size = int16_t(info1->short_name.size());
918-
type1.def.kind = SymbolKind::TypeParameter;
919-
type1.def.parent_kind = SymbolKind::Class;
920-
var->def.type = usr1;
921-
type1.instances.push_back(usr);
922-
break;
923-
}
924-
}
925-
#endif
926-
927899
IndexParam::DeclInfo *info1;
928900
Usr usr1 = getUsr(d1, &info1);
929901
var->def.type = usr1;
@@ -1237,10 +1209,8 @@ class IndexFrontendAction : public ASTFrontendAction {
12371209
std::make_unique<IndexPPCallbacks>(pp->getSourceManager(), param));
12381210
std::vector<std::unique_ptr<ASTConsumer>> consumers;
12391211
consumers.push_back(std::make_unique<SkipProcessed>(param));
1240-
#if LLVM_VERSION_MAJOR >= 10 // rC370337
12411212
consumers.push_back(index::createIndexingASTConsumer(
12421213
dataConsumer, indexOpts, std::move(pp)));
1243-
#endif
12441214
return std::make_unique<MultiplexConsumer>(std::move(consumers));
12451215
}
12461216
};
@@ -1349,12 +1319,7 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs,
13491319
if (!clang->hasTarget())
13501320
return {};
13511321
clang->getPreprocessorOpts().RetainRemappedFileBuffers = true;
1352-
#if LLVM_VERSION_MAJOR >= 9 // rC357037
13531322
clang->createFileManager(fs);
1354-
#else
1355-
clang->setVirtualFileSystem(fs);
1356-
clang->createFileManager();
1357-
#endif
13581323
clang->setSourceManager(new SourceManager(clang->getDiagnostics(),
13591324
clang->getFileManager(), true));
13601325

@@ -1366,39 +1331,23 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs,
13661331
if (no_linkage) {
13671332
indexOpts.IndexFunctionLocals = true;
13681333
indexOpts.IndexImplicitInstantiation = true;
1369-
#if LLVM_VERSION_MAJOR >= 9
1370-
13711334
indexOpts.IndexParametersInDeclarations =
13721335
g_config->index.parametersInDeclarations;
13731336
indexOpts.IndexTemplateParameters = true;
1374-
#endif
13751337
}
13761338

1377-
#if LLVM_VERSION_MAJOR >= 10 // rC370337
13781339
auto action = std::make_unique<IndexFrontendAction>(
13791340
std::make_shared<IndexDataConsumer>(param), indexOpts, param);
1380-
#else
1381-
auto dataConsumer = std::make_shared<IndexDataConsumer>(param);
1382-
auto action = createIndexingAction(
1383-
dataConsumer, indexOpts,
1384-
std::make_unique<IndexFrontendAction>(dataConsumer, indexOpts, param));
1385-
#endif
1386-
13871341
std::string reason;
13881342
{
13891343
llvm::CrashRecoveryContext crc;
13901344
auto parse = [&]() {
13911345
if (!action->BeginSourceFile(*clang, clang->getFrontendOpts().Inputs[0]))
13921346
return;
1393-
#if LLVM_VERSION_MAJOR >= 9 // rL364464
13941347
if (llvm::Error e = action->Execute()) {
13951348
reason = llvm::toString(std::move(e));
13961349
return;
13971350
}
1398-
#else
1399-
if (!action->Execute())
1400-
return;
1401-
#endif
14021351
action->EndSourceFile();
14031352
ok = true;
14041353
};

0 commit comments

Comments
 (0)