Clang: Improve Macro collection

Now undefined macros are added to used macros but we filter out header
guards and dynamic libraries export. The export is quite simple but
without we would think that exports change the AST.

Change-Id: Ic16f60a6675e397dfd769c53caf77056708d8459
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-01-23 14:10:17 +01:00
parent effa4d830f
commit 4f0c17bc5d
4 changed files with 161 additions and 25 deletions

View File

@@ -33,12 +33,14 @@ namespace ClangBackEnd {
bool CollectMacrosSourceFileCallbacks::handleBeginSource(clang::CompilerInstance &compilerInstance)
{
auto callbacks = std::make_unique<CollectMacrosPreprocessorCallbacks>(m_symbolEntries,
m_sourceLocationEntries,
m_sourceFiles,
m_usedDefines,
m_filePathCache,
compilerInstance.getSourceManager());
auto callbacks = std::make_unique<CollectMacrosPreprocessorCallbacks>(
m_symbolEntries,
m_sourceLocationEntries,
m_sourceFiles,
m_usedDefines,
m_filePathCache,
compilerInstance.getSourceManager(),
compilerInstance.getPreprocessorPtr());
compilerInstance.getPreprocessorPtr()->addPPCallbacks(std::move(callbacks));