aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2018-03-22 13:57:03 +0100
committerMarco Bubke <marco.bubke@qt.io>2018-03-27 14:45:35 +0000
commit576eb3370c9b14c4423ba3a8e7e72a977342bf86 (patch)
tree4475e89233032588229c752256440dbb03575804 /src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h
parent41a12410e6045d8aaff46f189ef01f5302199925 (diff)
Clang: Use the clang indexer for indexing
It is not removing so much code but will makes somethings easier in the future. We added the SymbolType::Definition too. Change-Id: I4e106b8518e6bfed0c6a4aa6be61c4a5fe5f8bef Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h')
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h b/src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h
index 6dfc969fad..dd4b61ec45 100644
--- a/src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h
+++ b/src/tools/clangrefactoringbackend/source/symbolsvisitorbase.h
@@ -43,15 +43,15 @@ class SymbolsVisitorBase
{
public:
SymbolsVisitorBase(FilePathCachingInterface &filePathCache,
- const clang::SourceManager &sourceManager)
+ const clang::SourceManager *sourceManager)
: m_filePathCache(filePathCache),
m_sourceManager(sourceManager)
{}
FilePathId filePathId(clang::SourceLocation sourceLocation)
{
- clang::FileID clangFileId = m_sourceManager.getFileID(sourceLocation);
- const clang::FileEntry *fileEntry = m_sourceManager.getFileEntryForID(clangFileId);
+ clang::FileID clangFileId = m_sourceManager->getFileID(sourceLocation);
+ const clang::FileEntry *fileEntry = m_sourceManager->getFileEntryForID(clangFileId);
return filePathId(fileEntry);
}
@@ -79,8 +79,8 @@ public:
Utils::LineColumn lineColum(clang::SourceLocation sourceLocation)
{
- return {int(m_sourceManager.getSpellingLineNumber(sourceLocation)),
- int(m_sourceManager.getSpellingColumnNumber(sourceLocation))};
+ return {int(m_sourceManager->getSpellingLineNumber(sourceLocation)),
+ int(m_sourceManager->getSpellingColumnNumber(sourceLocation))};
}
static Utils::optional<Utils::PathString> generateUSR(const clang::Decl *declaration)
@@ -106,7 +106,7 @@ public:
bool wasNotWorking = clang::index::generateUSRForMacro(macroName,
sourceLocation,
- m_sourceManager,
+ *m_sourceManager,
usr);
if (!wasNotWorking)
@@ -120,10 +120,15 @@ public:
return SymbolIndex(reinterpret_cast<std::uintptr_t>(pointer));
}
+ void setSourceManager(const clang::SourceManager *sourceManager)
+ {
+ m_sourceManager = sourceManager;
+ }
+
protected:
std::unordered_map<uint, FilePathId> m_filePathIndices;
FilePathCachingInterface &m_filePathCache;
- const clang::SourceManager &m_sourceManager;
+ const clang::SourceManager *m_sourceManager = nullptr;
};
} // namespace ClangBackend