forked from qt-creator/qt-creator
ClangRefactoring: Improve indexing
Fix some bugs in the indexing and use the new macro indexer from clang. Change-Id: I2ba1b28097a8751aea942071851a60d164c6f371 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -129,8 +129,7 @@ void BuildDependencyCollector::collect()
|
|||||||
|
|
||||||
auto action = std::make_unique<CollectBuildDependencyToolAction>(m_buildDependency,
|
auto action = std::make_unique<CollectBuildDependencyToolAction>(m_buildDependency,
|
||||||
m_filePathCache,
|
m_filePathCache,
|
||||||
m_excludedFilePaths,
|
m_excludedFilePaths);
|
||||||
m_sourcesManager);
|
|
||||||
|
|
||||||
tool.run(action.get());
|
tool.run(action.get());
|
||||||
}
|
}
|
||||||
|
@@ -95,7 +95,6 @@ private:
|
|||||||
BuildDependency m_buildDependency;
|
BuildDependency m_buildDependency;
|
||||||
ClangBackEnd::FilePaths m_excludedFilePaths;
|
ClangBackEnd::FilePaths m_excludedFilePaths;
|
||||||
Utils::SmallStringVector m_directories;
|
Utils::SmallStringVector m_directories;
|
||||||
SourcesManager m_sourcesManager;
|
|
||||||
const FilePathCachingInterface &m_filePathCache;
|
const FilePathCachingInterface &m_filePathCache;
|
||||||
const GeneratedFilesInterface &m_generatedFiles;
|
const GeneratedFilesInterface &m_generatedFiles;
|
||||||
const Environment &m_environment;
|
const Environment &m_environment;
|
||||||
|
@@ -40,15 +40,13 @@ class CollectBuildDependencyAction final : public clang::PreprocessOnlyAction
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CollectBuildDependencyAction(BuildDependency &buildDependency,
|
CollectBuildDependencyAction(BuildDependency &buildDependency,
|
||||||
const FilePathCachingInterface &filePathCache,
|
const FilePathCachingInterface &filePathCache,
|
||||||
std::vector<uint> &excludedIncludeUID,
|
std::vector<uint> &excludedIncludeUID,
|
||||||
std::vector<uint> &alreadyIncludedFileUIDs,
|
std::vector<uint> &alreadyIncludedFileUIDs)
|
||||||
SourcesManager &sourcesManager)
|
: m_buildDependency(buildDependency)
|
||||||
: m_buildDependency(buildDependency),
|
, m_filePathCache(filePathCache)
|
||||||
m_filePathCache(filePathCache),
|
, m_excludedIncludeUID(excludedIncludeUID)
|
||||||
m_excludedIncludeUID(excludedIncludeUID),
|
, m_alreadyIncludedFileUIDs(alreadyIncludedFileUIDs)
|
||||||
m_alreadyIncludedFileUIDs(alreadyIncludedFileUIDs),
|
|
||||||
m_sourcesManager(sourcesManager)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +64,6 @@ public:
|
|||||||
m_excludedIncludeUID,
|
m_excludedIncludeUID,
|
||||||
m_alreadyIncludedFileUIDs,
|
m_alreadyIncludedFileUIDs,
|
||||||
compilerInstance.getSourceManager(),
|
compilerInstance.getSourceManager(),
|
||||||
m_sourcesManager,
|
|
||||||
compilerInstance.getPreprocessorPtr());
|
compilerInstance.getPreprocessorPtr());
|
||||||
|
|
||||||
preprocessor.addPPCallbacks(
|
preprocessor.addPPCallbacks(
|
||||||
@@ -88,7 +85,6 @@ private:
|
|||||||
const FilePathCachingInterface &m_filePathCache;
|
const FilePathCachingInterface &m_filePathCache;
|
||||||
std::vector<uint> &m_excludedIncludeUID;
|
std::vector<uint> &m_excludedIncludeUID;
|
||||||
std::vector<uint> &m_alreadyIncludedFileUIDs;
|
std::vector<uint> &m_alreadyIncludedFileUIDs;
|
||||||
SourcesManager &m_sourcesManager;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
} // namespace ClangBackEnd
|
||||||
|
@@ -54,12 +54,10 @@ public:
|
|||||||
const std::vector<uint> &excludedIncludeUID,
|
const std::vector<uint> &excludedIncludeUID,
|
||||||
std::vector<uint> &alreadyIncludedFileUIDs,
|
std::vector<uint> &alreadyIncludedFileUIDs,
|
||||||
clang::SourceManager &sourceManager,
|
clang::SourceManager &sourceManager,
|
||||||
SourcesManager &sourcesManager,
|
|
||||||
std::shared_ptr<clang::Preprocessor> preprocessor)
|
std::shared_ptr<clang::Preprocessor> preprocessor)
|
||||||
: CollectUsedMacrosAndSourcesPreprocessorCallbacksBase(buildDependency.usedMacros,
|
: CollectUsedMacrosAndSourcesPreprocessorCallbacksBase(buildDependency.usedMacros,
|
||||||
filePathCache,
|
filePathCache,
|
||||||
sourceManager,
|
sourceManager,
|
||||||
sourcesManager,
|
|
||||||
preprocessor,
|
preprocessor,
|
||||||
buildDependency.sourceDependencies,
|
buildDependency.sourceDependencies,
|
||||||
buildDependency.sourceFiles,
|
buildDependency.sourceFiles,
|
||||||
@@ -189,7 +187,6 @@ public:
|
|||||||
{
|
{
|
||||||
filterOutHeaderGuards();
|
filterOutHeaderGuards();
|
||||||
mergeUsedMacros();
|
mergeUsedMacros();
|
||||||
m_sourcesManager.updateModifiedTimeStamps();
|
|
||||||
filterOutIncludesWithMissingIncludes();
|
filterOutIncludesWithMissingIncludes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,13 +38,11 @@ class CollectBuildDependencyToolAction final : public clang::tooling::FrontendAc
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CollectBuildDependencyToolAction(BuildDependency &buildDependency,
|
CollectBuildDependencyToolAction(BuildDependency &buildDependency,
|
||||||
const FilePathCachingInterface &filePathCache,
|
const FilePathCachingInterface &filePathCache,
|
||||||
const ClangBackEnd::FilePaths &excludedIncludes,
|
const ClangBackEnd::FilePaths &excludedIncludes)
|
||||||
SourcesManager &sourcesManager)
|
: m_buildDependency(buildDependency)
|
||||||
: m_buildDependency(buildDependency),
|
, m_filePathCache(filePathCache)
|
||||||
m_filePathCache(filePathCache),
|
, m_excludedFilePaths(excludedIncludes)
|
||||||
m_excludedFilePaths(excludedIncludes),
|
|
||||||
m_sourcesManager(sourcesManager)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@@ -67,8 +65,7 @@ public:
|
|||||||
return new CollectBuildDependencyAction(m_buildDependency,
|
return new CollectBuildDependencyAction(m_buildDependency,
|
||||||
m_filePathCache,
|
m_filePathCache,
|
||||||
m_excludedIncludeUIDs,
|
m_excludedIncludeUIDs,
|
||||||
m_alreadyIncludedFileUIDs,
|
m_alreadyIncludedFileUIDs);
|
||||||
m_sourcesManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint> generateExcludedIncludeFileUIDs(clang::FileManager &fileManager) const
|
std::vector<uint> generateExcludedIncludeFileUIDs(clang::FileManager &fileManager) const
|
||||||
@@ -95,7 +92,6 @@ private:
|
|||||||
BuildDependency &m_buildDependency;
|
BuildDependency &m_buildDependency;
|
||||||
const FilePathCachingInterface &m_filePathCache;
|
const FilePathCachingInterface &m_filePathCache;
|
||||||
const ClangBackEnd::FilePaths &m_excludedFilePaths;
|
const ClangBackEnd::FilePaths &m_excludedFilePaths;
|
||||||
SourcesManager &m_sourcesManager;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
} // namespace ClangBackEnd
|
||||||
|
@@ -39,13 +39,11 @@ class CollectUsedMacrosToolActionFactory final : public clang::tooling::Frontend
|
|||||||
public:
|
public:
|
||||||
CollectUsedMacrosToolActionFactory(UsedMacros &usedMacros,
|
CollectUsedMacrosToolActionFactory(UsedMacros &usedMacros,
|
||||||
FilePathCachingInterface &filePathCache,
|
FilePathCachingInterface &filePathCache,
|
||||||
SourcesManager &sourcesManager,
|
|
||||||
SourceDependencies &sourceDependencies,
|
SourceDependencies &sourceDependencies,
|
||||||
FilePathIds &sourceFiles,
|
FilePathIds &sourceFiles,
|
||||||
FileStatuses &fileStatuses)
|
FileStatuses &fileStatuses)
|
||||||
: m_usedMacros(usedMacros),
|
: m_usedMacros(usedMacros),
|
||||||
m_filePathCache(filePathCache),
|
m_filePathCache(filePathCache),
|
||||||
m_sourcesManager(sourcesManager),
|
|
||||||
m_sourceDependencies(sourceDependencies),
|
m_sourceDependencies(sourceDependencies),
|
||||||
m_sourceFiles(sourceFiles),
|
m_sourceFiles(sourceFiles),
|
||||||
m_fileStatuses(fileStatuses)
|
m_fileStatuses(fileStatuses)
|
||||||
@@ -67,7 +65,6 @@ public:
|
|||||||
{
|
{
|
||||||
return new CollectUsedMacrosAction(m_usedMacros,
|
return new CollectUsedMacrosAction(m_usedMacros,
|
||||||
m_filePathCache,
|
m_filePathCache,
|
||||||
m_sourcesManager,
|
|
||||||
m_sourceDependencies,
|
m_sourceDependencies,
|
||||||
m_sourceFiles,
|
m_sourceFiles,
|
||||||
m_fileStatuses);
|
m_fileStatuses);
|
||||||
@@ -76,7 +73,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
UsedMacros &m_usedMacros;
|
UsedMacros &m_usedMacros;
|
||||||
FilePathCachingInterface &m_filePathCache;
|
FilePathCachingInterface &m_filePathCache;
|
||||||
SourcesManager &m_sourcesManager;
|
|
||||||
SourceDependencies &m_sourceDependencies;
|
SourceDependencies &m_sourceDependencies;
|
||||||
FilePathIds &m_sourceFiles;
|
FilePathIds &m_sourceFiles;
|
||||||
FileStatuses &m_fileStatuses;
|
FileStatuses &m_fileStatuses;
|
||||||
|
@@ -41,13 +41,11 @@ class CollectUsedMacrosAction final : public clang::PreprocessOnlyAction
|
|||||||
public:
|
public:
|
||||||
CollectUsedMacrosAction(UsedMacros &usedMacros,
|
CollectUsedMacrosAction(UsedMacros &usedMacros,
|
||||||
FilePathCachingInterface &filePathCache,
|
FilePathCachingInterface &filePathCache,
|
||||||
SourcesManager &sourcesManager,
|
|
||||||
SourceDependencies &sourceDependencies,
|
SourceDependencies &sourceDependencies,
|
||||||
FilePathIds &sourceFiles,
|
FilePathIds &sourceFiles,
|
||||||
FileStatuses &fileStatuses)
|
FileStatuses &fileStatuses)
|
||||||
: m_usedMacros(usedMacros),
|
: m_usedMacros(usedMacros),
|
||||||
m_filePathCache(filePathCache),
|
m_filePathCache(filePathCache),
|
||||||
m_sourcesManager(sourcesManager),
|
|
||||||
m_sourceDependencies(sourceDependencies),
|
m_sourceDependencies(sourceDependencies),
|
||||||
m_sourceFiles(sourceFiles),
|
m_sourceFiles(sourceFiles),
|
||||||
m_fileStatuses(fileStatuses)
|
m_fileStatuses(fileStatuses)
|
||||||
@@ -65,7 +63,6 @@ public:
|
|||||||
m_usedMacros,
|
m_usedMacros,
|
||||||
m_filePathCache,
|
m_filePathCache,
|
||||||
compilerInstance.getSourceManager(),
|
compilerInstance.getSourceManager(),
|
||||||
m_sourcesManager,
|
|
||||||
compilerInstance.getPreprocessorPtr(),
|
compilerInstance.getPreprocessorPtr(),
|
||||||
m_sourceDependencies,
|
m_sourceDependencies,
|
||||||
m_sourceFiles,
|
m_sourceFiles,
|
||||||
@@ -87,7 +84,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
UsedMacros &m_usedMacros;
|
UsedMacros &m_usedMacros;
|
||||||
FilePathCachingInterface &m_filePathCache;
|
FilePathCachingInterface &m_filePathCache;
|
||||||
SourcesManager &m_sourcesManager;
|
|
||||||
SourceDependencies &m_sourceDependencies;
|
SourceDependencies &m_sourceDependencies;
|
||||||
FilePathIds &m_sourceFiles;
|
FilePathIds &m_sourceFiles;
|
||||||
FileStatuses &m_fileStatuses;
|
FileStatuses &m_fileStatuses;
|
||||||
|
@@ -54,17 +54,16 @@ public:
|
|||||||
CollectUsedMacrosAndSourcesPreprocessorCallbacksBase(UsedMacros &usedMacros,
|
CollectUsedMacrosAndSourcesPreprocessorCallbacksBase(UsedMacros &usedMacros,
|
||||||
const FilePathCachingInterface &filePathCache,
|
const FilePathCachingInterface &filePathCache,
|
||||||
const clang::SourceManager &sourceManager,
|
const clang::SourceManager &sourceManager,
|
||||||
SourcesManager &sourcesManager,
|
|
||||||
std::shared_ptr<clang::Preprocessor> preprocessor,
|
std::shared_ptr<clang::Preprocessor> preprocessor,
|
||||||
SourceDependencies &sourceDependencies,
|
SourceDependencies &sourceDependencies,
|
||||||
FilePathIds &sourceFiles,
|
FilePathIds &sourceFiles,
|
||||||
FileStatuses &fileStatuses)
|
FileStatuses &fileStatuses)
|
||||||
: SymbolsVisitorBase(filePathCache, &sourceManager, sourcesManager),
|
: SymbolsVisitorBase(filePathCache, &sourceManager, m_filePathIndices)
|
||||||
m_usedMacros(usedMacros),
|
, m_usedMacros(usedMacros)
|
||||||
m_preprocessor(preprocessor),
|
, m_preprocessor(preprocessor)
|
||||||
m_sourceDependencies(sourceDependencies),
|
, m_sourceDependencies(sourceDependencies)
|
||||||
m_sourceFiles(sourceFiles),
|
, m_sourceFiles(sourceFiles)
|
||||||
m_fileStatuses(fileStatuses)
|
, m_fileStatuses(fileStatuses)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void addSourceFile(const clang::FileEntry *fileEntry)
|
void addSourceFile(const clang::FileEntry *fileEntry)
|
||||||
@@ -166,6 +165,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
UsedMacros m_maybeUsedMacros;
|
UsedMacros m_maybeUsedMacros;
|
||||||
|
FilePathIds m_filePathIndices;
|
||||||
UsedMacros &m_usedMacros;
|
UsedMacros &m_usedMacros;
|
||||||
std::shared_ptr<clang::Preprocessor> m_preprocessor;
|
std::shared_ptr<clang::Preprocessor> m_preprocessor;
|
||||||
SourceDependencies &m_sourceDependencies;
|
SourceDependencies &m_sourceDependencies;
|
||||||
@@ -248,7 +248,6 @@ public:
|
|||||||
{
|
{
|
||||||
filterOutHeaderGuards();
|
filterOutHeaderGuards();
|
||||||
mergeUsedMacros();
|
mergeUsedMacros();
|
||||||
m_sourcesManager.updateModifiedTimeStamps();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -48,7 +48,6 @@ void UsedMacroAndSourcesCollector::collect()
|
|||||||
auto action = std::make_unique<CollectUsedMacrosToolActionFactory>(
|
auto action = std::make_unique<CollectUsedMacrosToolActionFactory>(
|
||||||
m_usedMacros,
|
m_usedMacros,
|
||||||
m_filePathCache,
|
m_filePathCache,
|
||||||
m_sourcesManager,
|
|
||||||
m_sourceDependencies,
|
m_sourceDependencies,
|
||||||
m_sourceFiles,
|
m_sourceFiles,
|
||||||
m_fileStatuses);
|
m_fileStatuses);
|
||||||
|
@@ -74,7 +74,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ClangTool m_clangTool;
|
ClangTool m_clangTool;
|
||||||
SourcesManager m_sourcesManager;
|
|
||||||
UsedMacros m_usedMacros;
|
UsedMacros m_usedMacros;
|
||||||
FilePathCachingInterface &m_filePathCache;
|
FilePathCachingInterface &m_filePathCache;
|
||||||
FilePathIds m_sourceFiles;
|
FilePathIds m_sourceFiles;
|
||||||
|
@@ -2,6 +2,7 @@ INCLUDEPATH += $$PWD
|
|||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/clangrefactoringbackend_global.h \
|
$$PWD/clangrefactoringbackend_global.h \
|
||||||
|
$$PWD/filestatuspreprocessorcallbacks.h \
|
||||||
$$PWD/sourcerangefilter.h \
|
$$PWD/sourcerangefilter.h \
|
||||||
$$PWD/symbolindexer.h \
|
$$PWD/symbolindexer.h \
|
||||||
$$PWD/symbolentry.h \
|
$$PWD/symbolentry.h \
|
||||||
@@ -64,6 +65,7 @@ HEADERS += \
|
|||||||
}
|
}
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
$$PWD/filestatuspreprocessorcallbacks.cpp \
|
||||||
$$PWD/sourcerangefilter.cpp \
|
$$PWD/sourcerangefilter.cpp \
|
||||||
$$PWD/symbolindexer.cpp \
|
$$PWD/symbolindexer.cpp \
|
||||||
$$PWD/filestatuscache.cpp
|
$$PWD/filestatuscache.cpp
|
||||||
|
@@ -56,18 +56,16 @@ public:
|
|||||||
SourceDependencies &sourceDependencies,
|
SourceDependencies &sourceDependencies,
|
||||||
FilePathCachingInterface &filePathCache,
|
FilePathCachingInterface &filePathCache,
|
||||||
const clang::SourceManager &sourceManager,
|
const clang::SourceManager &sourceManager,
|
||||||
std::shared_ptr<clang::Preprocessor> &&preprocessor,
|
std::shared_ptr<clang::Preprocessor> &&preprocessor)
|
||||||
SourcesManager &sourcesManager)
|
|
||||||
: CollectUsedMacrosAndSourcesPreprocessorCallbacksBase(usedMacros,
|
: CollectUsedMacrosAndSourcesPreprocessorCallbacksBase(usedMacros,
|
||||||
filePathCache,
|
filePathCache,
|
||||||
sourceManager,
|
sourceManager,
|
||||||
sourcesManager,
|
|
||||||
std::move(preprocessor),
|
std::move(preprocessor),
|
||||||
sourceDependencies,
|
sourceDependencies,
|
||||||
sourceFiles,
|
sourceFiles,
|
||||||
fileStatuses),
|
fileStatuses)
|
||||||
m_symbolEntries(symbolEntries),
|
, m_symbolEntries(symbolEntries)
|
||||||
m_sourceLocationEntries(sourceLocationEntries)
|
, m_sourceLocationEntries(sourceLocationEntries)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,17 +86,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InclusionDirective(clang::SourceLocation hashLocation,
|
void InclusionDirective(clang::SourceLocation hashLocation,
|
||||||
const clang::Token &/*includeToken*/,
|
const clang::Token & /*includeToken*/,
|
||||||
llvm::StringRef /*fileName*/,
|
llvm::StringRef /*fileName*/,
|
||||||
bool /*isAngled*/,
|
bool /*isAngled*/,
|
||||||
clang::CharSourceRange /*fileNameRange*/,
|
clang::CharSourceRange /*fileNameRange*/,
|
||||||
const clang::FileEntry *file,
|
const clang::FileEntry *file,
|
||||||
llvm::StringRef /*searchPath*/,
|
llvm::StringRef /*searchPath*/,
|
||||||
llvm::StringRef /*relativePath*/,
|
llvm::StringRef /*relativePath*/,
|
||||||
const clang::Module * /*imported*/
|
const clang::Module * /*imported*/,
|
||||||
#if LLVM_VERSION_MAJOR >= 7
|
clang::SrcMgr::CharacteristicKind /*fileType*/
|
||||||
, clang::SrcMgr::CharacteristicKind /*fileType*/
|
|
||||||
#endif
|
|
||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
if (!m_skipInclude && file)
|
if (!m_skipInclude && file)
|
||||||
@@ -174,7 +170,6 @@ public:
|
|||||||
{
|
{
|
||||||
filterOutHeaderGuards();
|
filterOutHeaderGuards();
|
||||||
mergeUsedMacros();
|
mergeUsedMacros();
|
||||||
m_sourcesManager.updateModifiedTimeStamps();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const clang::MacroInfo *firstMacroInfo(const clang::MacroDirective *macroDirective)
|
static const clang::MacroInfo *firstMacroInfo(const clang::MacroDirective *macroDirective)
|
||||||
|
@@ -34,16 +34,15 @@ namespace ClangBackEnd {
|
|||||||
bool CollectMacrosSourceFileCallbacks::handleBeginSource(clang::CompilerInstance &compilerInstance)
|
bool CollectMacrosSourceFileCallbacks::handleBeginSource(clang::CompilerInstance &compilerInstance)
|
||||||
{
|
{
|
||||||
auto callbacks = std::make_unique<CollectMacrosPreprocessorCallbacks>(
|
auto callbacks = std::make_unique<CollectMacrosPreprocessorCallbacks>(
|
||||||
m_symbolEntries,
|
m_symbolEntries,
|
||||||
m_sourceLocationEntries,
|
m_sourceLocationEntries,
|
||||||
m_sourceFiles,
|
m_sourceFiles,
|
||||||
m_usedMacros,
|
m_usedMacros,
|
||||||
m_fileStatuses,
|
m_fileStatuses,
|
||||||
m_sourceDependencies,
|
m_sourceDependencies,
|
||||||
m_filePathCache,
|
m_filePathCache,
|
||||||
compilerInstance.getSourceManager(),
|
compilerInstance.getSourceManager(),
|
||||||
compilerInstance.getPreprocessorPtr(),
|
compilerInstance.getPreprocessorPtr());
|
||||||
m_sourcesManager);
|
|
||||||
|
|
||||||
compilerInstance.getPreprocessorPtr()->addPPCallbacks(std::move(callbacks));
|
compilerInstance.getPreprocessorPtr()->addPPCallbacks(std::move(callbacks));
|
||||||
|
|
||||||
|
@@ -44,12 +44,10 @@ class CollectMacrosSourceFileCallbacks : public clang::tooling::SourceFileCallba
|
|||||||
public:
|
public:
|
||||||
CollectMacrosSourceFileCallbacks(SymbolEntries &symbolEntries,
|
CollectMacrosSourceFileCallbacks(SymbolEntries &symbolEntries,
|
||||||
SourceLocationEntries &sourceLocationEntries,
|
SourceLocationEntries &sourceLocationEntries,
|
||||||
FilePathCachingInterface &filePathCache,
|
FilePathCachingInterface &filePathCache)
|
||||||
SourcesManager &sourcesManager)
|
: m_symbolEntries(symbolEntries)
|
||||||
: m_symbolEntries(symbolEntries),
|
, m_sourceLocationEntries(sourceLocationEntries)
|
||||||
m_sourceLocationEntries(sourceLocationEntries),
|
, m_filePathCache(filePathCache)
|
||||||
m_filePathCache(filePathCache),
|
|
||||||
m_sourcesManager(sourcesManager)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +94,6 @@ private:
|
|||||||
SymbolEntries &m_symbolEntries;
|
SymbolEntries &m_symbolEntries;
|
||||||
SourceLocationEntries &m_sourceLocationEntries;
|
SourceLocationEntries &m_sourceLocationEntries;
|
||||||
FilePathCachingInterface &m_filePathCache;
|
FilePathCachingInterface &m_filePathCache;
|
||||||
SourcesManager &m_sourcesManager;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
} // namespace ClangBackEnd
|
||||||
|
@@ -33,8 +33,7 @@ std::unique_ptr<clang::ASTConsumer> CollectSymbolsAction::newASTConsumer(
|
|||||||
clang::CompilerInstance &compilerInstance,
|
clang::CompilerInstance &compilerInstance,
|
||||||
llvm::StringRef inFile)
|
llvm::StringRef inFile)
|
||||||
{
|
{
|
||||||
m_indexDataConsumer->setSourceManager(&compilerInstance.getSourceManager());
|
return clang::WrapperFrontendAction::CreateASTConsumer(compilerInstance, inFile);
|
||||||
return m_action.CreateASTConsumer(compilerInstance, inFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
} // namespace ClangBackEnd
|
||||||
|
@@ -26,8 +26,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clangrefactoringbackend_global.h"
|
#include "clangrefactoringbackend_global.h"
|
||||||
#include "sourcelocationentry.h"
|
|
||||||
#include "indexdataconsumer.h"
|
#include "indexdataconsumer.h"
|
||||||
|
#include "sourcelocationentry.h"
|
||||||
#include "symbolentry.h"
|
#include "symbolentry.h"
|
||||||
|
|
||||||
#include <utils/smallstring.h>
|
#include <utils/smallstring.h>
|
||||||
@@ -37,53 +37,68 @@
|
|||||||
#include <clang/Frontend/CompilerInstance.h>
|
#include <clang/Frontend/CompilerInstance.h>
|
||||||
#include <clang/Frontend/FrontendAction.h>
|
#include <clang/Frontend/FrontendAction.h>
|
||||||
#include <clang/Index/IndexingAction.h>
|
#include <clang/Index/IndexingAction.h>
|
||||||
|
#include <clang/Lex/PreprocessorOptions.h>
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
class CollectSymbolsAction
|
class CollectSymbolsAction : public clang::WrapperFrontendAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CollectSymbolsAction(std::shared_ptr<IndexDataConsumer> indexDataConsumer)
|
CollectSymbolsAction(std::shared_ptr<IndexDataConsumer> indexDataConsumer)
|
||||||
: m_action(indexDataConsumer, createIndexingOptions()),
|
: clang::WrapperFrontendAction(
|
||||||
m_indexDataConsumer(indexDataConsumer.get())
|
clang::index::createIndexingAction(indexDataConsumer, createIndexingOptions(), nullptr))
|
||||||
|
, m_indexDataConsumer(indexDataConsumer)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::unique_ptr<clang::ASTConsumer> newASTConsumer(clang::CompilerInstance &compilerInstance,
|
std::unique_ptr<clang::ASTConsumer> newASTConsumer(clang::CompilerInstance &compilerInstance,
|
||||||
llvm::StringRef inFile);
|
llvm::StringRef inFile);
|
||||||
private:
|
|
||||||
class WrappedIndexAction final : public clang::WrapperFrontendAction
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WrappedIndexAction(std::shared_ptr<clang::index::IndexDataConsumer> indexDataConsumer,
|
|
||||||
clang::index::IndexingOptions indexingOptions)
|
|
||||||
: clang::WrapperFrontendAction(
|
|
||||||
clang::index::createIndexingAction(indexDataConsumer, indexingOptions, nullptr))
|
|
||||||
{}
|
|
||||||
|
|
||||||
std::unique_ptr<clang::ASTConsumer>
|
static clang::index::IndexingOptions createIndexingOptions()
|
||||||
CreateASTConsumer(clang::CompilerInstance &compilerInstance,
|
|
||||||
llvm::StringRef inFile) override
|
|
||||||
{
|
|
||||||
return WrapperFrontendAction::CreateASTConsumer(compilerInstance, inFile);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static
|
|
||||||
clang::index::IndexingOptions createIndexingOptions()
|
|
||||||
{
|
{
|
||||||
clang::index::IndexingOptions options;
|
clang::index::IndexingOptions options;
|
||||||
|
|
||||||
options.SystemSymbolFilter = clang::index::IndexingOptions::SystemSymbolFilterKind::None;
|
options.SystemSymbolFilter = clang::index::IndexingOptions::SystemSymbolFilterKind::None;
|
||||||
options.IndexFunctionLocals = true;
|
options.IndexFunctionLocals = true;
|
||||||
|
options.IndexMacrosInPreprocessor = true;
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BeginInvocation(clang::CompilerInstance &compilerInstance) override
|
||||||
|
{
|
||||||
|
m_indexDataConsumer->setSourceManager(&compilerInstance.getSourceManager());
|
||||||
|
compilerInstance.getPreprocessorOpts().AllowPCHWithCompilerErrors = true;
|
||||||
|
compilerInstance.getDiagnosticOpts().ErrorLimit = 1;
|
||||||
|
|
||||||
|
return clang::WrapperFrontendAction::BeginInvocation(compilerInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BeginSourceFileAction(clang::CompilerInstance &compilerInstance) override
|
||||||
|
{
|
||||||
|
compilerInstance.getPreprocessor().SetSuppressIncludeNotFoundError(true);
|
||||||
|
|
||||||
|
return clang::WrapperFrontendAction::BeginSourceFileAction(compilerInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EndSourceFileAction() override { clang::WrapperFrontendAction::EndSourceFileAction(); }
|
||||||
|
|
||||||
|
bool PrepareToExecuteAction(clang::CompilerInstance &instance) override
|
||||||
|
{
|
||||||
|
return clang::WrapperFrontendAction::PrepareToExecuteAction(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExecuteAction() override { clang::WrapperFrontendAction::ExecuteAction(); }
|
||||||
|
|
||||||
|
std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance &compilerInstance,
|
||||||
|
llvm::StringRef inFile) override
|
||||||
|
{
|
||||||
|
return WrapperFrontendAction::CreateASTConsumer(compilerInstance, inFile);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WrappedIndexAction m_action;
|
std::shared_ptr<IndexDataConsumer> m_indexDataConsumer;
|
||||||
IndexDataConsumer *m_indexDataConsumer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
} // namespace ClangBackEnd
|
||||||
|
@@ -0,0 +1,59 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2019 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "filestatuspreprocessorcallbacks.h"
|
||||||
|
|
||||||
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
|
void FileStatusPreprocessorCallbacks::FileChanged(clang::SourceLocation sourceLocation,
|
||||||
|
clang::PPCallbacks::FileChangeReason reason,
|
||||||
|
clang::SrcMgr::CharacteristicKind,
|
||||||
|
clang::FileID)
|
||||||
|
{
|
||||||
|
if (reason == clang::PPCallbacks::EnterFile) {
|
||||||
|
const clang::FileEntry *fileEntry = m_sourceManager->getFileEntryForID(
|
||||||
|
m_sourceManager->getFileID(sourceLocation));
|
||||||
|
if (fileEntry)
|
||||||
|
addFileStatus(fileEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileStatusPreprocessorCallbacks::addFileStatus(const clang::FileEntry *fileEntry)
|
||||||
|
{
|
||||||
|
auto id = filePathId(fileEntry);
|
||||||
|
|
||||||
|
auto found = std::lower_bound(m_fileStatuses.begin(),
|
||||||
|
m_fileStatuses.end(),
|
||||||
|
id,
|
||||||
|
[](const auto &first, const auto &second) {
|
||||||
|
return first.filePathId < second;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (found == m_fileStatuses.end() || found->filePathId != id) {
|
||||||
|
m_fileStatuses.emplace(found, id, fileEntry->getSize(), fileEntry->getModificationTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ClangBackEnd
|
@@ -0,0 +1,59 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2019 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "filestatus.h"
|
||||||
|
#include "symbolsvisitorbase.h"
|
||||||
|
|
||||||
|
#include <filepathid.h>
|
||||||
|
|
||||||
|
#include <clang/Lex/PPCallbacks.h>
|
||||||
|
|
||||||
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
|
class FileStatusPreprocessorCallbacks final : public clang::PPCallbacks, public SymbolsVisitorBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FileStatusPreprocessorCallbacks(FileStatuses &fileStatuses,
|
||||||
|
const FilePathCachingInterface &filePathCache,
|
||||||
|
const clang::SourceManager *sourceManager,
|
||||||
|
FilePathIds &filePathIndices)
|
||||||
|
: SymbolsVisitorBase(filePathCache, sourceManager, filePathIndices)
|
||||||
|
, m_fileStatuses(fileStatuses)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void FileChanged(clang::SourceLocation sourceLocation,
|
||||||
|
clang::PPCallbacks::FileChangeReason reason,
|
||||||
|
clang::SrcMgr::CharacteristicKind,
|
||||||
|
clang::FileID) override;
|
||||||
|
|
||||||
|
void addFileStatus(const clang::FileEntry *fileEntry);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FileStatuses &m_fileStatuses;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ClangBackEnd
|
@@ -24,11 +24,13 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "indexdataconsumer.h"
|
#include "indexdataconsumer.h"
|
||||||
|
#include "collectsymbolsaction.h"
|
||||||
|
#include "filestatuspreprocessorcallbacks.h"
|
||||||
|
|
||||||
|
#include <clang/AST/DeclVisitor.h>
|
||||||
#include <clang/Basic/SourceLocation.h>
|
#include <clang/Basic/SourceLocation.h>
|
||||||
#include <clang/Index/IndexSymbol.h>
|
#include <clang/Index/IndexSymbol.h>
|
||||||
#include <clang/AST/Decl.h>
|
#include <clang/Index/IndexingAction.h>
|
||||||
#include <clang/AST/DeclVisitor.h>
|
|
||||||
|
|
||||||
#include <llvm/ADT/ArrayRef.h>
|
#include <llvm/ADT/ArrayRef.h>
|
||||||
|
|
||||||
@@ -115,33 +117,41 @@ bool isReference(clang::index::SymbolRoleSet symbolRoles)
|
|||||||
return symbolRoles & (uint(SymbolRole::Reference) | uint(SymbolRole::Call));
|
return symbolRoles & (uint(SymbolRole::Reference) | uint(SymbolRole::Call));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
bool IndexDataConsumer::skipSymbol(clang::FileID fileId, clang::index::SymbolRoleSet symbolRoles)
|
bool IndexDataConsumer::skipSymbol(clang::FileID fileId, clang::index::SymbolRoleSet symbolRoles)
|
||||||
{
|
{
|
||||||
bool alreadyParsed = isAlreadyParsed(fileId);
|
return isAlreadyParsed(fileId, m_symbolSourcesManager)
|
||||||
bool isParsedDeclaration = alreadyParsed && isDeclaration(symbolRoles);
|
&& !m_symbolSourcesManager.dependentFilesModified();
|
||||||
bool isParsedReference = alreadyParsed && !dependentFilesAreModified() && isReference(symbolRoles);
|
|
||||||
|
|
||||||
return isParsedDeclaration || isParsedReference;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IndexDataConsumer::handleDeclOccurence(
|
bool IndexDataConsumer::isAlreadyParsed(clang::FileID fileId, SourcesManager &sourcesManager)
|
||||||
const clang::Decl *declaration,
|
{
|
||||||
clang::index::SymbolRoleSet symbolRoles,
|
const clang::FileEntry *fileEntry = m_sourceManager->getFileEntryForID(fileId);
|
||||||
llvm::ArrayRef<clang::index::SymbolRelation> /*symbolRelations*/,
|
if (!fileEntry)
|
||||||
clang::SourceLocation sourceLocation,
|
return false;
|
||||||
IndexDataConsumer::ASTNodeInfo /*astNodeInfo*/)
|
return sourcesManager.alreadyParsed(filePathId(fileEntry), fileEntry->getModificationTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
void IndexDataConsumer::setPreprocessor(std::shared_ptr<clang::Preprocessor> preprocessor)
|
||||||
|
{
|
||||||
|
preprocessor->addPPCallbacks(std::make_unique<FileStatusPreprocessorCallbacks>(
|
||||||
|
m_fileStatuses, m_filePathCache, m_sourceManager, m_filePathIndices));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IndexDataConsumer::handleDeclOccurence(const clang::Decl *declaration,
|
||||||
|
clang::index::SymbolRoleSet symbolRoles,
|
||||||
|
llvm::ArrayRef<clang::index::SymbolRelation> /*symbolRelations*/,
|
||||||
|
clang::SourceLocation sourceLocation,
|
||||||
|
IndexDataConsumer::ASTNodeInfo /*astNodeInfo*/)
|
||||||
{
|
{
|
||||||
const auto *namedDeclaration = clang::dyn_cast<clang::NamedDecl>(declaration);
|
const auto *namedDeclaration = clang::dyn_cast<clang::NamedDecl>(declaration);
|
||||||
if (namedDeclaration) {
|
if (namedDeclaration) {
|
||||||
if (!namedDeclaration->getIdentifier())
|
if (!namedDeclaration->getIdentifier())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (skipSymbol(m_sourceManager->getFileID(sourceLocation), symbolRoles)) {
|
if (skipSymbol(m_sourceManager->getFileID(sourceLocation), symbolRoles))
|
||||||
namedDeclaration->getDeclName().dump();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
SymbolIndex globalId = toSymbolIndex(declaration->getCanonicalDecl());
|
SymbolIndex globalId = toSymbolIndex(declaration->getCanonicalDecl());
|
||||||
|
|
||||||
@@ -168,4 +178,64 @@ bool IndexDataConsumer::handleDeclOccurence(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
SourceLocationKind macroSymbolType(clang::index::SymbolRoleSet roles)
|
||||||
|
{
|
||||||
|
if (roles & static_cast<clang::index::SymbolRoleSet>(clang::index::SymbolRole::Definition))
|
||||||
|
return SourceLocationKind::MacroDefinition;
|
||||||
|
|
||||||
|
if (roles & static_cast<clang::index::SymbolRoleSet>(clang::index::SymbolRole::Undefinition))
|
||||||
|
return SourceLocationKind::MacroUndefinition;
|
||||||
|
|
||||||
|
if (roles & static_cast<clang::index::SymbolRoleSet>(clang::index::SymbolRole::Reference))
|
||||||
|
return SourceLocationKind::MacroUsage;
|
||||||
|
|
||||||
|
return SourceLocationKind::None;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
bool IndexDataConsumer::handleMacroOccurence(const clang::IdentifierInfo *identifierInfo,
|
||||||
|
const clang::MacroInfo *macroInfo,
|
||||||
|
clang::index::SymbolRoleSet roles,
|
||||||
|
clang::SourceLocation sourceLocation)
|
||||||
|
{
|
||||||
|
if (macroInfo && sourceLocation.isFileID()
|
||||||
|
&& !isAlreadyParsed(m_sourceManager->getFileID(sourceLocation), m_macroSourcesManager)
|
||||||
|
&& !isInSystemHeader(sourceLocation)) {
|
||||||
|
FilePathId fileId = filePathId(sourceLocation);
|
||||||
|
if (fileId.isValid()) {
|
||||||
|
auto macroName = identifierInfo->getName();
|
||||||
|
SymbolIndex globalId = toSymbolIndex(macroInfo);
|
||||||
|
|
||||||
|
auto found = m_symbolEntries.find(globalId);
|
||||||
|
if (found == m_symbolEntries.end()) {
|
||||||
|
Utils::optional<Utils::PathString> usr = generateUSR(macroName, sourceLocation);
|
||||||
|
if (usr) {
|
||||||
|
m_symbolEntries.emplace(std::piecewise_construct,
|
||||||
|
std::forward_as_tuple(globalId),
|
||||||
|
std::forward_as_tuple(std::move(*usr),
|
||||||
|
macroName,
|
||||||
|
SymbolKind::Macro));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sourceLocationEntries.emplace_back(globalId,
|
||||||
|
fileId,
|
||||||
|
lineColum(sourceLocation),
|
||||||
|
macroSymbolType(roles));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IndexDataConsumer::finish()
|
||||||
|
{
|
||||||
|
m_macroSourcesManager.updateModifiedTimeStamps();
|
||||||
|
m_symbolSourcesManager.updateModifiedTimeStamps();
|
||||||
|
m_filePathIndices.clear();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
} // namespace ClangBackEnd
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clangrefactoringbackend_global.h"
|
#include "clangrefactoringbackend_global.h"
|
||||||
|
#include "filestatus.h"
|
||||||
#include "sourcelocationentry.h"
|
#include "sourcelocationentry.h"
|
||||||
#include "symbolentry.h"
|
#include "symbolentry.h"
|
||||||
#include "symbolsvisitorbase.h"
|
#include "symbolsvisitorbase.h"
|
||||||
@@ -42,28 +43,48 @@ class IndexDataConsumer : public clang::index::IndexDataConsumer,
|
|||||||
public:
|
public:
|
||||||
IndexDataConsumer(SymbolEntries &symbolEntries,
|
IndexDataConsumer(SymbolEntries &symbolEntries,
|
||||||
SourceLocationEntries &sourceLocationEntries,
|
SourceLocationEntries &sourceLocationEntries,
|
||||||
|
FileStatuses &fileStatuses,
|
||||||
FilePathCachingInterface &filePathCache,
|
FilePathCachingInterface &filePathCache,
|
||||||
SourcesManager &sourcesManager)
|
SourcesManager &symbolSourcesManager,
|
||||||
: SymbolsVisitorBase(filePathCache, nullptr, sourcesManager),
|
SourcesManager ¯oSourcesManager)
|
||||||
m_symbolEntries(symbolEntries),
|
: SymbolsVisitorBase(filePathCache, nullptr, m_filePathIndices)
|
||||||
m_sourceLocationEntries(sourceLocationEntries)
|
, m_symbolEntries(symbolEntries)
|
||||||
|
, m_sourceLocationEntries(sourceLocationEntries)
|
||||||
|
, m_fileStatuses(fileStatuses)
|
||||||
|
, m_symbolSourcesManager(symbolSourcesManager)
|
||||||
|
, m_macroSourcesManager(macroSourcesManager)
|
||||||
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
IndexDataConsumer(const IndexDataConsumer &) = delete;
|
IndexDataConsumer(const IndexDataConsumer &) = delete;
|
||||||
IndexDataConsumer &operator=(const IndexDataConsumer &) = delete;
|
IndexDataConsumer &operator=(const IndexDataConsumer &) = delete;
|
||||||
|
|
||||||
|
void setPreprocessor(std::shared_ptr<clang::Preprocessor> preprocessor) override;
|
||||||
|
|
||||||
bool handleDeclOccurence(const clang::Decl *declaration,
|
bool handleDeclOccurence(const clang::Decl *declaration,
|
||||||
clang::index::SymbolRoleSet symbolRoles,
|
clang::index::SymbolRoleSet symbolRoles,
|
||||||
llvm::ArrayRef<clang::index::SymbolRelation> symbolRelations,
|
llvm::ArrayRef<clang::index::SymbolRelation> symbolRelations,
|
||||||
clang::SourceLocation sourceLocation,
|
clang::SourceLocation sourceLocation,
|
||||||
ASTNodeInfo astNodeInfo) override;
|
ASTNodeInfo astNodeInfo) override;
|
||||||
|
|
||||||
private:
|
bool handleMacroOccurence(const clang::IdentifierInfo *identifierInfo,
|
||||||
bool skipSymbol(clang::FileID fileId, clang::index::SymbolRoleSet symbolRoles);
|
const clang::MacroInfo *macroInfo,
|
||||||
|
clang::index::SymbolRoleSet roles,
|
||||||
|
clang::SourceLocation sourceLocation) override;
|
||||||
|
|
||||||
|
void finish() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool skipSymbol(clang::FileID fileId, clang::index::SymbolRoleSet symbolRoles);
|
||||||
|
bool isAlreadyParsed(clang::FileID fileId, SourcesManager &sourcesManager);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FilePathIds m_filePathIndices;
|
||||||
SymbolEntries &m_symbolEntries;
|
SymbolEntries &m_symbolEntries;
|
||||||
SourceLocationEntries &m_sourceLocationEntries;
|
SourceLocationEntries &m_sourceLocationEntries;
|
||||||
|
FileStatuses &m_fileStatuses;
|
||||||
|
SourcesManager &m_symbolSourcesManager;
|
||||||
|
SourcesManager &m_macroSourcesManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
} // namespace ClangBackEnd
|
||||||
|
@@ -32,10 +32,14 @@
|
|||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
SymbolsCollector::SymbolsCollector(Sqlite::Database &database)
|
SymbolsCollector::SymbolsCollector(Sqlite::Database &database)
|
||||||
: m_filePathCache(database),
|
: m_filePathCache(database)
|
||||||
m_indexDataConsumer(std::make_shared<IndexDataConsumer>(m_symbolEntries, m_sourceLocationEntries, m_filePathCache, m_sourcesManager)),
|
, m_indexDataConsumer(std::make_shared<IndexDataConsumer>(m_symbolEntries,
|
||||||
m_collectSymbolsAction(m_indexDataConsumer),
|
m_sourceLocationEntries,
|
||||||
m_collectMacrosSourceFileCallbacks(m_symbolEntries, m_sourceLocationEntries, m_filePathCache, m_sourcesManager)
|
m_fileStatuses,
|
||||||
|
m_filePathCache,
|
||||||
|
m_symbolSourcesManager,
|
||||||
|
m_macroSourcesManager))
|
||||||
|
, m_collectSymbolsAction(m_indexDataConsumer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +47,6 @@ void SymbolsCollector::addFiles(const FilePathIds &filePathIds,
|
|||||||
const Utils::SmallStringVector &arguments)
|
const Utils::SmallStringVector &arguments)
|
||||||
{
|
{
|
||||||
m_clangTool.addFiles(m_filePathCache.filePaths(filePathIds), arguments);
|
m_clangTool.addFiles(m_filePathCache.filePaths(filePathIds), arguments);
|
||||||
m_collectMacrosSourceFileCallbacks.addSourceFiles(filePathIds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SymbolsCollector::setFile(FilePathId filePathId, const Utils::SmallStringVector &arguments)
|
void SymbolsCollector::setFile(FilePathId filePathId, const Utils::SmallStringVector &arguments)
|
||||||
@@ -58,90 +61,73 @@ void SymbolsCollector::setUnsavedFiles(const V2::FileContainers &unsavedFiles)
|
|||||||
|
|
||||||
void SymbolsCollector::clear()
|
void SymbolsCollector::clear()
|
||||||
{
|
{
|
||||||
m_indexDataConsumer->clear();
|
|
||||||
m_collectMacrosSourceFileCallbacks.clear();
|
|
||||||
m_symbolEntries.clear();
|
m_symbolEntries.clear();
|
||||||
m_sourceLocationEntries.clear();
|
m_sourceLocationEntries.clear();
|
||||||
|
m_fileStatuses.clear();
|
||||||
m_clangTool = ClangTool();
|
m_clangTool = ClangTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Factory>
|
std::unique_ptr<clang::tooling::FrontendActionFactory> newFrontendActionFactory(CollectSymbolsAction *action)
|
||||||
std::unique_ptr<clang::tooling::FrontendActionFactory>
|
|
||||||
newFrontendActionFactory(Factory *consumerFactory,
|
|
||||||
clang::tooling::SourceFileCallbacks *sourceFileCallbacks)
|
|
||||||
{
|
{
|
||||||
class FrontendActionFactoryAdapter : public clang::tooling::FrontendActionFactory
|
class FrontendActionFactoryAdapter : public clang::tooling::FrontendActionFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FrontendActionFactoryAdapter(Factory *consumerFactory,
|
explicit FrontendActionFactoryAdapter(CollectSymbolsAction *consumerFactory)
|
||||||
clang::tooling::SourceFileCallbacks *sourceFileCallbacks)
|
: m_action(consumerFactory)
|
||||||
: m_consumerFactory(consumerFactory),
|
|
||||||
m_sourceFileCallbacks(sourceFileCallbacks)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
clang::FrontendAction *create() override {
|
clang::FrontendAction *create() override { return new AdaptorAction(m_action); }
|
||||||
return new ConsumerFactoryAdaptor(m_consumerFactory, m_sourceFileCallbacks);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class ConsumerFactoryAdaptor : public clang::ASTFrontendAction {
|
class AdaptorAction : public clang::ASTFrontendAction
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
ConsumerFactoryAdaptor(Factory *consumerFactory,
|
AdaptorAction(CollectSymbolsAction *action)
|
||||||
clang::tooling::SourceFileCallbacks *sourceFileCallbacks)
|
: m_action(action)
|
||||||
: m_consumerFactory(consumerFactory),
|
|
||||||
m_sourceFileCallbacks(sourceFileCallbacks)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance &instance,
|
std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance &instance,
|
||||||
llvm::StringRef inFile) override
|
llvm::StringRef inFile) override
|
||||||
{
|
{
|
||||||
return m_consumerFactory->newASTConsumer(instance, inFile);
|
return m_action->newASTConsumer(instance, inFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
bool BeginInvocation(clang::CompilerInstance &instance) override
|
||||||
bool BeginInvocation(clang::CompilerInstance &compilerInstance) override
|
|
||||||
{
|
{
|
||||||
compilerInstance.getPreprocessorOpts().AllowPCHWithCompilerErrors = true;
|
return m_action->BeginInvocation(instance);
|
||||||
|
|
||||||
return clang::ASTFrontendAction::BeginInvocation(compilerInstance);
|
|
||||||
}
|
}
|
||||||
|
bool BeginSourceFileAction(clang::CompilerInstance &instance) override
|
||||||
bool BeginSourceFileAction(clang::CompilerInstance &compilerInstance) override
|
|
||||||
{
|
{
|
||||||
compilerInstance.getPreprocessor().SetSuppressIncludeNotFoundError(true);
|
return m_action->BeginSourceFileAction(instance);
|
||||||
|
|
||||||
if (!clang::ASTFrontendAction::BeginSourceFileAction(compilerInstance))
|
|
||||||
return false;
|
|
||||||
if (m_sourceFileCallbacks)
|
|
||||||
return m_sourceFileCallbacks->handleBeginSource(compilerInstance);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndSourceFileAction() override
|
bool PrepareToExecuteAction(clang::CompilerInstance &instance) override
|
||||||
{
|
{
|
||||||
if (m_sourceFileCallbacks)
|
return m_action->PrepareToExecuteAction(instance);
|
||||||
m_sourceFileCallbacks->handleEndSource();
|
|
||||||
clang::ASTFrontendAction::EndSourceFileAction();
|
|
||||||
}
|
}
|
||||||
|
void ExecuteAction() override { m_action->ExecuteAction(); }
|
||||||
|
void EndSourceFileAction() override { m_action->EndSourceFileAction(); }
|
||||||
|
|
||||||
|
bool hasPCHSupport() const override { return m_action->hasPCHSupport(); }
|
||||||
|
bool hasASTFileSupport() const override { return m_action->hasASTFileSupport(); }
|
||||||
|
bool hasIRSupport() const override { return false; }
|
||||||
|
bool hasCodeCompletionSupport() const override { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Factory *m_consumerFactory;
|
CollectSymbolsAction *m_action;
|
||||||
clang::tooling::SourceFileCallbacks *m_sourceFileCallbacks;
|
|
||||||
};
|
};
|
||||||
Factory *m_consumerFactory;
|
CollectSymbolsAction *m_action;
|
||||||
clang::tooling::SourceFileCallbacks *m_sourceFileCallbacks;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return std::unique_ptr<clang::tooling::FrontendActionFactory>(
|
return std::unique_ptr<clang::tooling::FrontendActionFactory>(
|
||||||
new FrontendActionFactoryAdapter(consumerFactory, sourceFileCallbacks));
|
new FrontendActionFactoryAdapter(action));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SymbolsCollector::collectSymbols()
|
bool SymbolsCollector::collectSymbols()
|
||||||
{
|
{
|
||||||
auto tool = m_clangTool.createTool();
|
auto tool = m_clangTool.createTool();
|
||||||
|
|
||||||
auto actionFactory = ClangBackEnd::newFrontendActionFactory(&m_collectSymbolsAction,
|
auto actionFactory = ClangBackEnd::newFrontendActionFactory(&m_collectSymbolsAction);
|
||||||
&m_collectMacrosSourceFileCallbacks);
|
|
||||||
|
|
||||||
return tool.run(actionFactory.get()) != 1;
|
return tool.run(actionFactory.get()) != 1;
|
||||||
}
|
}
|
||||||
@@ -160,24 +146,9 @@ const SourceLocationEntries &SymbolsCollector::sourceLocations() const
|
|||||||
return m_sourceLocationEntries;
|
return m_sourceLocationEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FilePathIds &SymbolsCollector::sourceFiles() const
|
|
||||||
{
|
|
||||||
return m_collectMacrosSourceFileCallbacks.sourceFiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
const UsedMacros &SymbolsCollector::usedMacros() const
|
|
||||||
{
|
|
||||||
return m_collectMacrosSourceFileCallbacks.usedMacros();
|
|
||||||
}
|
|
||||||
|
|
||||||
const FileStatuses &SymbolsCollector::fileStatuses() const
|
const FileStatuses &SymbolsCollector::fileStatuses() const
|
||||||
{
|
{
|
||||||
return m_collectMacrosSourceFileCallbacks.fileStatuses();
|
return m_fileStatuses;
|
||||||
}
|
|
||||||
|
|
||||||
const SourceDependencies &SymbolsCollector::sourceDependencies() const
|
|
||||||
{
|
|
||||||
return m_collectMacrosSourceFileCallbacks.sourceDependencies();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SymbolsCollector::isUsed() const
|
bool SymbolsCollector::isUsed() const
|
||||||
|
@@ -58,10 +58,7 @@ public:
|
|||||||
|
|
||||||
const SymbolEntries &symbols() const override;
|
const SymbolEntries &symbols() const override;
|
||||||
const SourceLocationEntries &sourceLocations() const override;
|
const SourceLocationEntries &sourceLocations() const override;
|
||||||
const FilePathIds &sourceFiles() const override;
|
|
||||||
const UsedMacros &usedMacros() const override;
|
|
||||||
const FileStatuses &fileStatuses() const override;
|
const FileStatuses &fileStatuses() const override;
|
||||||
const SourceDependencies &sourceDependencies() const override;
|
|
||||||
|
|
||||||
bool isUsed() const override;
|
bool isUsed() const override;
|
||||||
void setIsUsed(bool isUsed) override;
|
void setIsUsed(bool isUsed) override;
|
||||||
@@ -71,10 +68,11 @@ private:
|
|||||||
ClangTool m_clangTool;
|
ClangTool m_clangTool;
|
||||||
SymbolEntries m_symbolEntries;
|
SymbolEntries m_symbolEntries;
|
||||||
SourceLocationEntries m_sourceLocationEntries;
|
SourceLocationEntries m_sourceLocationEntries;
|
||||||
|
FileStatuses m_fileStatuses;
|
||||||
std::shared_ptr<IndexDataConsumer> m_indexDataConsumer;
|
std::shared_ptr<IndexDataConsumer> m_indexDataConsumer;
|
||||||
CollectSymbolsAction m_collectSymbolsAction;
|
CollectSymbolsAction m_collectSymbolsAction;
|
||||||
CollectMacrosSourceFileCallbacks m_collectMacrosSourceFileCallbacks;
|
SourcesManager m_symbolSourcesManager;
|
||||||
SourcesManager m_sourcesManager;
|
SourcesManager m_macroSourcesManager;
|
||||||
bool m_isUsed = false;
|
bool m_isUsed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -48,10 +48,7 @@ public:
|
|||||||
|
|
||||||
virtual const SymbolEntries &symbols() const = 0;
|
virtual const SymbolEntries &symbols() const = 0;
|
||||||
virtual const SourceLocationEntries &sourceLocations() const = 0;
|
virtual const SourceLocationEntries &sourceLocations() const = 0;
|
||||||
virtual const FilePathIds &sourceFiles() const = 0;
|
|
||||||
virtual const UsedMacros &usedMacros() const = 0;
|
|
||||||
virtual const FileStatuses &fileStatuses() const = 0;
|
virtual const FileStatuses &fileStatuses() const = 0;
|
||||||
virtual const SourceDependencies &sourceDependencies() const = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
} // namespace ClangBackEnd
|
||||||
|
@@ -46,10 +46,10 @@ class SymbolsVisitorBase
|
|||||||
public:
|
public:
|
||||||
SymbolsVisitorBase(const FilePathCachingInterface &filePathCache,
|
SymbolsVisitorBase(const FilePathCachingInterface &filePathCache,
|
||||||
const clang::SourceManager *sourceManager,
|
const clang::SourceManager *sourceManager,
|
||||||
SourcesManager &sourcesManager)
|
FilePathIds &filePathIndices)
|
||||||
: m_filePathCache(filePathCache),
|
: m_filePathCache(filePathCache)
|
||||||
m_sourceManager(sourceManager),
|
, m_sourceManager(sourceManager)
|
||||||
m_sourcesManager(sourcesManager)
|
, m_filePathIndices(filePathIndices)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
FilePathId filePathId(clang::SourceLocation sourceLocation)
|
FilePathId filePathId(clang::SourceLocation sourceLocation)
|
||||||
@@ -60,25 +60,6 @@ public:
|
|||||||
return filePathId(fileEntry);
|
return filePathId(fileEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dependentFilesAreModified()
|
|
||||||
{
|
|
||||||
return m_sourcesManager.dependentFilesModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isAlreadyParsed(clang::FileID fileId)
|
|
||||||
{
|
|
||||||
const clang::FileEntry *fileEntry = m_sourceManager->getFileEntryForID(fileId);
|
|
||||||
if (!fileEntry)
|
|
||||||
return false;
|
|
||||||
return m_sourcesManager.alreadyParsed(filePathId(fileEntry),
|
|
||||||
fileEntry->getModificationTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool alreadyParsed(clang::SourceLocation sourceLocation)
|
|
||||||
{
|
|
||||||
return isAlreadyParsed(m_sourceManager->getFileID(sourceLocation));
|
|
||||||
}
|
|
||||||
|
|
||||||
FilePathId filePathId(const clang::FileEntry *fileEntry)
|
FilePathId filePathId(const clang::FileEntry *fileEntry)
|
||||||
{
|
{
|
||||||
if (fileEntry) {
|
if (fileEntry) {
|
||||||
@@ -156,22 +137,26 @@ public:
|
|||||||
return isSystem(m_sourceManager->getSLocEntry(fileId).getFile().getFileCharacteristic());
|
return isSystem(m_sourceManager->getSLocEntry(fileId).getFile().getFileCharacteristic());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isInSystemHeader(clang::SourceLocation sourceLocation) const
|
||||||
|
{
|
||||||
|
return m_sourceManager->isInSystemHeader(sourceLocation);
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
bool isSystem(clang::SrcMgr::CharacteristicKind kind)
|
bool isSystem(clang::SrcMgr::CharacteristicKind kind)
|
||||||
{
|
{
|
||||||
return clang::SrcMgr::isSystem(kind);
|
return clang::SrcMgr::isSystem(kind);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear()
|
const FilePathCachingInterface &filePathCache() const { return m_filePathCache; }
|
||||||
{
|
const clang::SourceManager *sourceManager() const { return m_sourceManager; }
|
||||||
m_filePathIndices.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<FilePathId> m_filePathIndices;
|
|
||||||
const FilePathCachingInterface &m_filePathCache;
|
const FilePathCachingInterface &m_filePathCache;
|
||||||
const clang::SourceManager *m_sourceManager = nullptr;
|
const clang::SourceManager *m_sourceManager = nullptr;
|
||||||
SourcesManager &m_sourcesManager;
|
|
||||||
|
private:
|
||||||
|
FilePathIds &m_filePathIndices;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ClangBackend
|
} // namespace ClangBackend
|
||||||
|
@@ -331,22 +331,6 @@ TEST_F(PchTaskQueue, DeleteProjectPchEntryInDatabaseIfNoPchIsGenerated)
|
|||||||
tasks.front()(mockPchCreator);
|
tasks.front()(mockPchCreator);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(PchTaskQueue, DeleteProjectPchEntryInDatabaseIfTasksHasNoIncludes)
|
|
||||||
{
|
|
||||||
InSequence s;
|
|
||||||
MockPchCreator mockPchCreator;
|
|
||||||
ClangBackEnd::ProjectPartPch projectPartPch{{}, "", 0};
|
|
||||||
projectTask1.includes = {};
|
|
||||||
auto tasks = queue.createProjectTasks({projectTask1});
|
|
||||||
|
|
||||||
EXPECT_CALL(mockPrecompiledHeaderStorage, fetchSystemPrecompiledHeaderPath(_)).Times(0);
|
|
||||||
EXPECT_CALL(mockPchCreator, generatePch(_)).Times(0);
|
|
||||||
EXPECT_CALL(mockPchCreator, projectPartPch()).Times(0);
|
|
||||||
EXPECT_CALL(mockPrecompiledHeaderStorage, deleteProjectPrecompiledHeader(Eq(1)));
|
|
||||||
|
|
||||||
tasks.front()(mockPchCreator);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(PchTaskQueue, CreateSystemTasksSizeEqualsInputSize)
|
TEST_F(PchTaskQueue, CreateSystemTasksSizeEqualsInputSize)
|
||||||
{
|
{
|
||||||
auto tasks = queue.createSystemTasks({systemTask1, systemTask2});
|
auto tasks = queue.createSystemTasks({systemTask1, systemTask2});
|
||||||
@@ -388,19 +372,4 @@ TEST_F(PchTaskQueue, DeleteSystemPchEntryInDatabaseIfNoPchIsGenerated)
|
|||||||
tasks.front()(mockPchCreator);
|
tasks.front()(mockPchCreator);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(PchTaskQueue, DeleteSystemPchEntryInDatabaseIfTasksHasNoIncludes)
|
|
||||||
{
|
|
||||||
InSequence s;
|
|
||||||
MockPchCreator mockPchCreator;
|
|
||||||
ClangBackEnd::ProjectPartPch projectPartPch{{}, "", 0};
|
|
||||||
systemTask4.includes = {};
|
|
||||||
auto tasks = queue.createSystemTasks({systemTask4});
|
|
||||||
|
|
||||||
EXPECT_CALL(mockPchCreator, generatePch(_)).Times(0);
|
|
||||||
EXPECT_CALL(mockPchCreator, projectPartPch()).Times(0);
|
|
||||||
EXPECT_CALL(mockPrecompiledHeaderStorage,
|
|
||||||
deleteSystemPrecompiledHeaders(UnorderedElementsAre(1, 3)));
|
|
||||||
|
|
||||||
tasks.front()(mockPchCreator);
|
|
||||||
}
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@@ -271,56 +271,6 @@ TEST_F(SymbolsCollector, DISABLED_ON_WINDOWS(CollectInUnsavedFile))
|
|||||||
Contains(HasSymbolName("function")));
|
Contains(HasSymbolName("function")));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, SourceFiles)
|
|
||||||
{
|
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
|
||||||
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.sourceFiles(),
|
|
||||||
UnorderedElementsAre(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"),
|
|
||||||
filePathId(TESTDATA_DIR "/symbolscollector/header1.h"),
|
|
||||||
filePathId(TESTDATA_DIR "/symbolscollector/header2.h")));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, MainFileInSourceFiles)
|
|
||||||
{
|
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.sourceFiles(),
|
|
||||||
ElementsAre(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp")));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, ResetMainFileInSourceFiles)
|
|
||||||
{
|
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.sourceFiles(),
|
|
||||||
ElementsAre(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp")));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, DontDuplicateSourceFiles)
|
|
||||||
{
|
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.sourceFiles(),
|
|
||||||
UnorderedElementsAre(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"),
|
|
||||||
filePathId(TESTDATA_DIR "/symbolscollector/header1.h"),
|
|
||||||
filePathId(TESTDATA_DIR "/symbolscollector/header2.h")));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, ClearSourceFiles)
|
|
||||||
{
|
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
|
||||||
|
|
||||||
collector.clear();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.sourceFiles(), IsEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, ClearSymbols)
|
TEST_F(SymbolsCollector, ClearSymbols)
|
||||||
{
|
{
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
||||||
@@ -351,27 +301,6 @@ TEST_F(SymbolsCollector, ClearFileStatus)
|
|||||||
ASSERT_THAT(collector.fileStatuses(), IsEmpty());
|
ASSERT_THAT(collector.fileStatuses(), IsEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, ClearUsedMacros)
|
|
||||||
{
|
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/defines.h"), {"cc"});
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
collector.clear();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.usedMacros(), IsEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, ClearSourceDependencies)
|
|
||||||
{
|
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main2.cpp"),
|
|
||||||
{"cc", "-I" TESTDATA_DIR});
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
collector.clear();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.sourceDependencies(), IsEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, DontCollectSymbolsAfterFilesAreCleared)
|
TEST_F(SymbolsCollector, DontCollectSymbolsAfterFilesAreCleared)
|
||||||
{
|
{
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
||||||
@@ -382,16 +311,6 @@ TEST_F(SymbolsCollector, DontCollectSymbolsAfterFilesAreCleared)
|
|||||||
ASSERT_THAT(collector.symbols(), IsEmpty());
|
ASSERT_THAT(collector.symbols(), IsEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, DontCollectSourceFilesAfterFilesAreCleared)
|
|
||||||
{
|
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
|
||||||
|
|
||||||
collector.clear();
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.sourceFiles(), IsEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, DontCollectFileStatusAfterFilesAreCleared)
|
TEST_F(SymbolsCollector, DontCollectFileStatusAfterFilesAreCleared)
|
||||||
{
|
{
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
||||||
@@ -402,82 +321,6 @@ TEST_F(SymbolsCollector, DontCollectFileStatusAfterFilesAreCleared)
|
|||||||
ASSERT_THAT(collector.fileStatuses(), IsEmpty());
|
ASSERT_THAT(collector.fileStatuses(), IsEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, DontCollectUsedMacrosAfterFilesAreCleared)
|
|
||||||
{
|
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
|
||||||
|
|
||||||
collector.clear();
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.usedMacros(), IsEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, DontCollectSourceDependenciesAfterFilesAreCleared)
|
|
||||||
{
|
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/main.cpp"), {"cc"});
|
|
||||||
|
|
||||||
collector.clear();
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.sourceDependencies(), IsEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectUsedMacrosWithExternalDefine)
|
|
||||||
{
|
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
|
||||||
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
|
||||||
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.usedMacros(),
|
|
||||||
ElementsAre(Eq(UsedMacro{"DEFINED", fileId}),
|
|
||||||
Eq(UsedMacro{"IF_DEFINE", fileId}),
|
|
||||||
Eq(UsedMacro{"__clang__", fileId}),
|
|
||||||
Eq(UsedMacro{"CLASS_EXPORT", fileId}),
|
|
||||||
Eq(UsedMacro{"IF_NOT_DEFINE", fileId}),
|
|
||||||
Eq(UsedMacro{"MACRO_EXPANSION", fileId}),
|
|
||||||
Eq(UsedMacro{"COMPILER_ARGUMENT", fileId})));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectUsedMacrosWithoutExternalDefine)
|
|
||||||
{
|
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
|
||||||
collector.setFile(fileId, {"cc"});
|
|
||||||
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.usedMacros(),
|
|
||||||
ElementsAre(Eq(UsedMacro{"DEFINED", fileId}),
|
|
||||||
Eq(UsedMacro{"IF_DEFINE", fileId}),
|
|
||||||
Eq(UsedMacro{"__clang__", fileId}),
|
|
||||||
Eq(UsedMacro{"CLASS_EXPORT", fileId}),
|
|
||||||
Eq(UsedMacro{"IF_NOT_DEFINE", fileId}),
|
|
||||||
Eq(UsedMacro{"MACRO_EXPANSION", fileId}),
|
|
||||||
Eq(UsedMacro{"COMPILER_ARGUMENT", fileId})));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, DontCollectHeaderGuards)
|
|
||||||
{
|
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
|
||||||
collector.setFile(fileId, {"cc"});
|
|
||||||
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.usedMacros(),
|
|
||||||
Not(Contains(Eq(UsedMacro{"SYMBOLSCOLLECTOR_DEFINES_H", fileId}))));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, DISABLED_DontCollectDynamicLibraryExports)
|
|
||||||
{
|
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
|
||||||
collector.setFile(fileId, {"cc"});
|
|
||||||
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.usedMacros(),
|
|
||||||
Not(Contains(Eq(UsedMacro{"CLASS_EXPORT", fileId}))));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectMacroDefinitionSourceLocation)
|
TEST_F(SymbolsCollector, CollectMacroDefinitionSourceLocation)
|
||||||
{
|
{
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
||||||
@@ -489,7 +332,7 @@ TEST_F(SymbolsCollector, CollectMacroDefinitionSourceLocation)
|
|||||||
Contains(IsSourceLocationEntry(symbolId("IF_NOT_DEFINE"), fileId, 4, 9, SourceLocationKind::MacroDefinition)));
|
Contains(IsSourceLocationEntry(symbolId("IF_NOT_DEFINE"), fileId, 4, 9, SourceLocationKind::MacroDefinition)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectMacroUsageInIfNotDefSourceLocation)
|
TEST_F(SymbolsCollector, DISABLED_CollectMacroUsageInIfNotDefSourceLocation)
|
||||||
{
|
{
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
||||||
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
||||||
@@ -500,7 +343,7 @@ TEST_F(SymbolsCollector, CollectMacroUsageInIfNotDefSourceLocation)
|
|||||||
Contains(IsSourceLocationEntry(symbolId("IF_NOT_DEFINE"), fileId, 6, 9, SourceLocationKind::MacroUsage)));
|
Contains(IsSourceLocationEntry(symbolId("IF_NOT_DEFINE"), fileId, 6, 9, SourceLocationKind::MacroUsage)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectSecondMacroUsageInIfNotDefSourceLocation)
|
TEST_F(SymbolsCollector, DISABLED_CollectSecondMacroUsageInIfNotDefSourceLocation)
|
||||||
{
|
{
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
||||||
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
||||||
@@ -511,7 +354,7 @@ TEST_F(SymbolsCollector, CollectSecondMacroUsageInIfNotDefSourceLocation)
|
|||||||
Contains(IsSourceLocationEntry(symbolId("IF_NOT_DEFINE"), fileId, 9, 9, SourceLocationKind::MacroUsage)));
|
Contains(IsSourceLocationEntry(symbolId("IF_NOT_DEFINE"), fileId, 9, 9, SourceLocationKind::MacroUsage)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectMacroUsageCompilerArgumentSourceLocation)
|
TEST_F(SymbolsCollector, DISABLED_CollectMacroUsageCompilerArgumentSourceLocation)
|
||||||
{
|
{
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
||||||
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
||||||
@@ -522,7 +365,7 @@ TEST_F(SymbolsCollector, CollectMacroUsageCompilerArgumentSourceLocation)
|
|||||||
Contains(IsSourceLocationEntry(symbolId("COMPILER_ARGUMENT"), fileId, 12, 9, SourceLocationKind::MacroUsage)));
|
Contains(IsSourceLocationEntry(symbolId("COMPILER_ARGUMENT"), fileId, 12, 9, SourceLocationKind::MacroUsage)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectMacroUsageInIfDefSourceLocation)
|
TEST_F(SymbolsCollector, DISABLED_CollectMacroUsageInIfDefSourceLocation)
|
||||||
{
|
{
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
||||||
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
||||||
@@ -533,7 +376,7 @@ TEST_F(SymbolsCollector, CollectMacroUsageInIfDefSourceLocation)
|
|||||||
Contains(IsSourceLocationEntry(symbolId("IF_DEFINE"), fileId, 17, 8, SourceLocationKind::MacroUsage)));
|
Contains(IsSourceLocationEntry(symbolId("IF_DEFINE"), fileId, 17, 8, SourceLocationKind::MacroUsage)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectMacroUsageInDefinedSourceLocation)
|
TEST_F(SymbolsCollector, DISABLED_CollectMacroUsageInDefinedSourceLocation)
|
||||||
{
|
{
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
||||||
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
||||||
@@ -566,7 +409,7 @@ TEST_F(SymbolsCollector, CollectMacroUsageUndefSourceLocation)
|
|||||||
Contains(IsSourceLocationEntry(symbolId("UN_DEFINE"), fileId, 34, 8, SourceLocationKind::MacroUndefinition)));
|
Contains(IsSourceLocationEntry(symbolId("UN_DEFINE"), fileId, 34, 8, SourceLocationKind::MacroUndefinition)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectMacroUsageBuiltInSourceLocation)
|
TEST_F(SymbolsCollector, DISABLED_CollectMacroUsageBuiltInSourceLocation)
|
||||||
{
|
{
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
||||||
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
||||||
@@ -588,7 +431,7 @@ TEST_F(SymbolsCollector, CollectMacroDefinitionSymbols)
|
|||||||
Contains(AllOf(HasSymbolName("IF_NOT_DEFINE"), HasSymbolKind(SymbolKind::Macro))));
|
Contains(AllOf(HasSymbolName("IF_NOT_DEFINE"), HasSymbolKind(SymbolKind::Macro))));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectMacroBuiltInSymbols)
|
TEST_F(SymbolsCollector, DISABLED_CollectMacroBuiltInSymbols)
|
||||||
{
|
{
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
||||||
collector.setFile(fileId, {"cc"});
|
collector.setFile(fileId, {"cc"});
|
||||||
@@ -599,7 +442,7 @@ TEST_F(SymbolsCollector, CollectMacroBuiltInSymbols)
|
|||||||
Contains(AllOf(HasSymbolName("__clang__"), HasSymbolKind(SymbolKind::Macro))));
|
Contains(AllOf(HasSymbolName("__clang__"), HasSymbolKind(SymbolKind::Macro))));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectMacroCompilerArgumentSymbols)
|
TEST_F(SymbolsCollector, DISABLED_CollectMacroCompilerArgumentSymbols)
|
||||||
{
|
{
|
||||||
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
auto fileId = filePathId(TESTDATA_DIR "/symbolscollector/defines.h");
|
||||||
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
collector.setFile(fileId, {"cc", "-DCOMPILER_ARGUMENT"});
|
||||||
@@ -623,23 +466,6 @@ TEST_F(SymbolsCollector, CollectFileStatuses)
|
|||||||
fileStatus(TESTDATA_DIR "/symbolscollector/header2.h")));
|
fileStatus(TESTDATA_DIR "/symbolscollector/header2.h")));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, CollectSourceDependencies)
|
|
||||||
{
|
|
||||||
auto mainFileId = filePathId(TESTDATA_DIR "/symbolscollector/main2.cpp");
|
|
||||||
auto header1FileId = filePathId(TESTDATA_DIR "/symbolscollector/header1.h");
|
|
||||||
auto header2FileId = filePathId(TESTDATA_DIR "/symbolscollector/header2.h");
|
|
||||||
auto header3FileId = filePathId(TESTDATA_DIR "/symbolscollector/header3.h");
|
|
||||||
collector.setFile(mainFileId, {"cc", "-I" TESTDATA_DIR});
|
|
||||||
|
|
||||||
collector.collectSymbols();
|
|
||||||
|
|
||||||
ASSERT_THAT(collector.sourceDependencies(),
|
|
||||||
UnorderedElementsAre(SourceDependency(mainFileId, header1FileId),
|
|
||||||
SourceDependency(mainFileId, header3FileId),
|
|
||||||
SourceDependency(header3FileId, header2FileId),
|
|
||||||
SourceDependency(header1FileId, header2FileId)));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, IsClassSymbol)
|
TEST_F(SymbolsCollector, IsClassSymbol)
|
||||||
{
|
{
|
||||||
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/symbolkind.cpp"), {"cc"});
|
collector.setFile(filePathId(TESTDATA_DIR "/symbolscollector/symbolkind.cpp"), {"cc"});
|
||||||
@@ -770,13 +596,13 @@ TEST_F(SymbolsCollector, DontIndexUnmodifiedHeaderFilesAtSecondRun)
|
|||||||
collector.collectSymbols();
|
collector.collectSymbols();
|
||||||
|
|
||||||
ASSERT_THAT(collector.symbols(),
|
ASSERT_THAT(collector.symbols(),
|
||||||
AllOf(
|
AllOf(Contains(HasSymbolName("HeaderFunctionReferenceInMainFile")),
|
||||||
Contains(HasSymbolName("HeaderFunctionReferenceInMainFile")),
|
Not(Contains(HasSymbolName("MemberReference"))),
|
||||||
Not(Contains(HasSymbolName("MemberReference"))),
|
Not(Contains(HasSymbolName("HeaderFunctionReference"))),
|
||||||
Not(Contains(HasSymbolName("HeaderFunctionReference"))),
|
Not(Contains(HasSymbolName("HeaderFunction"))),
|
||||||
Not(Contains(HasSymbolName("HeaderFunction"))),
|
Not(Contains(HasSymbolName("Class"))),
|
||||||
Not(Contains(HasSymbolName("Class"))),
|
Not(Contains(HasSymbolName("Member"))),
|
||||||
Not(Contains(HasSymbolName("Member")))));
|
Not(Contains(HasSymbolName("HEADER_DEFINE")))));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, DontIndexUnmodifiedHeaderFilesAtTouchHeader)
|
TEST_F(SymbolsCollector, DontIndexUnmodifiedHeaderFilesAtTouchHeader)
|
||||||
@@ -792,13 +618,14 @@ TEST_F(SymbolsCollector, DontIndexUnmodifiedHeaderFilesAtTouchHeader)
|
|||||||
collector.collectSymbols();
|
collector.collectSymbols();
|
||||||
|
|
||||||
ASSERT_THAT(collector.symbols(),
|
ASSERT_THAT(collector.symbols(),
|
||||||
AllOf(
|
AllOf(Contains(HasSymbolName("TouchHeaderFunction")),
|
||||||
Contains(HasSymbolName("HeaderFunctionReferenceInMainFile")),
|
Contains(HasSymbolName("HeaderFunctionReferenceInMainFile")),
|
||||||
Not(Contains(HasSymbolName("MemberReference"))),
|
Not(Contains(HasSymbolName("MemberReference"))),
|
||||||
Not(Contains(HasSymbolName("HeaderFunctionReference"))),
|
Not(Contains(HasSymbolName("HeaderFunctionReference"))),
|
||||||
Not(Contains(HasSymbolName("HeaderFunction"))),
|
Not(Contains(HasSymbolName("HeaderFunction"))),
|
||||||
Not(Contains(HasSymbolName("Class"))),
|
Not(Contains(HasSymbolName("Class"))),
|
||||||
Not(Contains(HasSymbolName("Member")))));
|
Not(Contains(HasSymbolName("Member"))),
|
||||||
|
Not(Contains(HasSymbolName("HEADER_DEFINE")))));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolsCollector, DontIndexSystemIncudes)
|
TEST_F(SymbolsCollector, DontIndexSystemIncudes)
|
||||||
|
Reference in New Issue
Block a user