@@ -710,9 +710,6 @@ class IndexDataConsumer : public index::IndexDataConsumer {
710
710
public:
711
711
IndexDataConsumer (IndexParam ¶m) : param(param) {}
712
712
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
716
713
bool handleDeclOccurrence (const Decl *d, index::SymbolRoleSet roles,
717
714
ArrayRef<index::SymbolRelation> relations,
718
715
SourceLocation src_loc,
@@ -899,31 +896,6 @@ class IndexDataConsumer : public index::IndexDataConsumer {
899
896
if (!isa<EnumConstantDecl>(d))
900
897
db->toType (usr1).instances .push_back (usr);
901
898
} 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
-
927
899
IndexParam::DeclInfo *info1;
928
900
Usr usr1 = getUsr (d1, &info1);
929
901
var->def .type = usr1;
@@ -1237,10 +1209,8 @@ class IndexFrontendAction : public ASTFrontendAction {
1237
1209
std::make_unique<IndexPPCallbacks>(pp->getSourceManager (), param));
1238
1210
std::vector<std::unique_ptr<ASTConsumer>> consumers;
1239
1211
consumers.push_back (std::make_unique<SkipProcessed>(param));
1240
- #if LLVM_VERSION_MAJOR >= 10 // rC370337
1241
1212
consumers.push_back (index ::createIndexingASTConsumer (
1242
1213
dataConsumer, indexOpts, std::move (pp)));
1243
- #endif
1244
1214
return std::make_unique<MultiplexConsumer>(std::move (consumers));
1245
1215
}
1246
1216
};
@@ -1349,12 +1319,7 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs,
1349
1319
if (!clang->hasTarget ())
1350
1320
return {};
1351
1321
clang->getPreprocessorOpts ().RetainRemappedFileBuffers = true ;
1352
- #if LLVM_VERSION_MAJOR >= 9 // rC357037
1353
1322
clang->createFileManager (fs);
1354
- #else
1355
- clang->setVirtualFileSystem (fs);
1356
- clang->createFileManager ();
1357
- #endif
1358
1323
clang->setSourceManager (new SourceManager (clang->getDiagnostics (),
1359
1324
clang->getFileManager (), true ));
1360
1325
@@ -1366,39 +1331,23 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs,
1366
1331
if (no_linkage) {
1367
1332
indexOpts.IndexFunctionLocals = true ;
1368
1333
indexOpts.IndexImplicitInstantiation = true ;
1369
- #if LLVM_VERSION_MAJOR >= 9
1370
-
1371
1334
indexOpts.IndexParametersInDeclarations =
1372
1335
g_config->index .parametersInDeclarations ;
1373
1336
indexOpts.IndexTemplateParameters = true ;
1374
- #endif
1375
1337
}
1376
1338
1377
- #if LLVM_VERSION_MAJOR >= 10 // rC370337
1378
1339
auto action = std::make_unique<IndexFrontendAction>(
1379
1340
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
-
1387
1341
std::string reason;
1388
1342
{
1389
1343
llvm::CrashRecoveryContext crc;
1390
1344
auto parse = [&]() {
1391
1345
if (!action->BeginSourceFile (*clang, clang->getFrontendOpts ().Inputs [0 ]))
1392
1346
return ;
1393
- #if LLVM_VERSION_MAJOR >= 9 // rL364464
1394
1347
if (llvm::Error e = action->Execute ()) {
1395
1348
reason = llvm::toString (std::move (e));
1396
1349
return ;
1397
1350
}
1398
- #else
1399
- if (!action->Execute ())
1400
- return ;
1401
- #endif
1402
1351
action->EndSourceFile ();
1403
1352
ok = true ;
1404
1353
};
0 commit comments