forked from qt-creator/qt-creator
Clang: Add symbols collector
Change-Id: I64c25eef8eaa6cc6c3ff09d41866972b6c7248d0 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -39,7 +39,7 @@ class FindingSymbolsASTConsumer : public clang::ASTConsumer
|
||||
{
|
||||
public:
|
||||
FindingSymbolsASTConsumer(std::vector<USRName> &unifiedSymbolResolutions)
|
||||
: unifiedSymbolResolutions(unifiedSymbolResolutions)
|
||||
: m_unifiedSymbolResolutions(unifiedSymbolResolutions)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
std::vector<clang::SourceLocation> sourceLocations;
|
||||
|
||||
|
||||
auto &&sourceLocationsOfUsr = takeLocationsOfUSRs(unifiedSymbolResolutions, context.getTranslationUnitDecl());
|
||||
auto &&sourceLocationsOfUsr = takeLocationsOfUSRs(m_unifiedSymbolResolutions, context.getTranslationUnitDecl());
|
||||
sourceLocations.insert(sourceLocations.end(),
|
||||
sourceLocationsOfUsr.begin(),
|
||||
sourceLocationsOfUsr.end());
|
||||
@@ -65,24 +65,24 @@ public:
|
||||
void updateSourceLocations(const std::vector<clang::SourceLocation> &sourceLocations,
|
||||
const clang::SourceManager &sourceManager)
|
||||
{
|
||||
appendSourceLocationsToSourceLocationsContainer(*sourceLocationsContainer, sourceLocations, sourceManager);
|
||||
appendSourceLocationsToSourceLocationsContainer(*m_sourceLocationsContainer, sourceLocations, sourceManager);
|
||||
}
|
||||
|
||||
void setSourceLocations(ClangBackEnd::SourceLocationsContainer *sourceLocations)
|
||||
{
|
||||
sourceLocationsContainer = sourceLocations;
|
||||
m_sourceLocationsContainer = sourceLocations;
|
||||
}
|
||||
|
||||
private:
|
||||
ClangBackEnd::SourceLocationsContainer *sourceLocationsContainer = nullptr;
|
||||
std::vector<USRName> &unifiedSymbolResolutions;
|
||||
ClangBackEnd::SourceLocationsContainer *m_sourceLocationsContainer = nullptr;
|
||||
std::vector<USRName> &m_unifiedSymbolResolutions;
|
||||
};
|
||||
|
||||
std::unique_ptr<clang::ASTConsumer> SymbolLocationFinderAction::newASTConsumer()
|
||||
{
|
||||
auto consumer = std::unique_ptr<FindingSymbolsASTConsumer>(new FindingSymbolsASTConsumer(unifiedSymbolResolutions_));
|
||||
auto consumer = std::unique_ptr<FindingSymbolsASTConsumer>(new FindingSymbolsASTConsumer(m_unifiedSymbolResolutions_));
|
||||
|
||||
consumer->setSourceLocations(&sourceLocations);
|
||||
consumer->setSourceLocations(&m_sourceLocations);
|
||||
|
||||
return std::move(consumer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user