summaryrefslogtreecommitdiff
path: root/tools/libclang/Indexing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libclang/Indexing.cpp')
-rw-r--r--tools/libclang/Indexing.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp
index 021ebcfcfe43..4da046b28233 100644
--- a/tools/libclang/Indexing.cpp
+++ b/tools/libclang/Indexing.cpp
@@ -45,7 +45,7 @@ namespace {
// Skip Parsed Bodies
//===----------------------------------------------------------------------===//
-/// \brief A "region" in source code identified by the file/offset of the
+/// A "region" in source code identified by the file/offset of the
/// preprocessor conditional directive that it belongs to.
/// Multiple, non-consecutive ranges can be parts of the same region.
///
@@ -249,7 +249,8 @@ public:
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported) override {
+ const Module *Imported,
+ SrcMgr::CharacteristicKind FileType) override {
bool isImport = (IncludeTok.is(tok::identifier) &&
IncludeTok.getIdentifierInfo()->getPPKeywordID() == tok::pp_import);
DataConsumer.ppIncludedFile(HashLoc, FileName, File, isImport, IsAngled,
@@ -401,6 +402,8 @@ static IndexingOptions getIndexingOptionsFromCXOptions(unsigned index_options) {
IndexingOptions IdxOpts;
if (index_options & CXIndexOpt_IndexFunctionLocalSymbols)
IdxOpts.IndexFunctionLocals = true;
+ if (index_options & CXIndexOpt_IndexImplicitTemplateInstantiations)
+ IdxOpts.IndexImplicitInstantiation = true;
return IdxOpts;
}
@@ -659,8 +662,7 @@ static CXErrorCode clang_indexTranslationUnit_Impl(
? index_callbacks_size : sizeof(CB);
memcpy(&CB, client_index_callbacks, ClientCBSize);
- auto DataConsumer = std::make_shared<CXIndexDataConsumer>(client_data, CB,
- index_options, TU);
+ CXIndexDataConsumer DataConsumer(client_data, CB, index_options, TU);
ASTUnit *Unit = cxtu::getASTUnit(TU);
if (!Unit)
@@ -669,21 +671,22 @@ static CXErrorCode clang_indexTranslationUnit_Impl(
ASTUnit::ConcurrencyCheck Check(*Unit);
if (const FileEntry *PCHFile = Unit->getPCHFile())
- DataConsumer->importedPCH(PCHFile);
+ DataConsumer.importedPCH(PCHFile);
FileManager &FileMgr = Unit->getFileManager();
if (Unit->getOriginalSourceFileName().empty())
- DataConsumer->enteredMainFile(nullptr);
+ DataConsumer.enteredMainFile(nullptr);
else
- DataConsumer->enteredMainFile(FileMgr.getFile(Unit->getOriginalSourceFileName()));
+ DataConsumer.enteredMainFile(
+ FileMgr.getFile(Unit->getOriginalSourceFileName()));
- DataConsumer->setASTContext(Unit->getASTContext());
- DataConsumer->startedTranslationUnit();
+ DataConsumer.setASTContext(Unit->getASTContext());
+ DataConsumer.startedTranslationUnit();
- indexPreprocessingRecord(*Unit, *DataConsumer);
+ indexPreprocessingRecord(*Unit, DataConsumer);
indexASTUnit(*Unit, DataConsumer, getIndexingOptionsFromCXOptions(index_options));
- DataConsumer->indexDiagnostics();
+ DataConsumer.indexDiagnostics();
return CXError_Success;
}