src: added optional indexer AST logging

* removed old AstVisitor
* added new implementation called CxxAstVisitor
* added CxxVerboseAstVisitor that may wrap the CxxAstVisitor to log the AST while visiting
* added the same structure for the Java visitors
* removed all the logs that were fired when recording stuff
* Added UI setting for verbose indexer logging.
* implemented AST name obfuscation for Java and Cxx
* unified test visitors for Java and Cxx
* implemented recording using directive decl
* removed most of the old onXxxParsed methods
This commit is contained in:
malte_langkabel
2016-11-01 10:37:30 +01:00
parent a4240def56
commit 9e4a02a33a
36 changed files with 2145 additions and 3208 deletions
@@ -55,10 +55,18 @@ void PreprocessorCallbacks::InclusionDirective(
FilePath includedFilePath = FilePath(fileEntry->getName()).canonical();
if (m_fileRegister->hasFilePath(includedFilePath))
{
m_client->onFileIncludeParsed(
getParseLocation(fileNameRange.getAsRange()),
m_fileRegister->getFileInfo(m_currentPath),
m_fileRegister->getFileInfo(includedFilePath)
NameHierarchy referencedNameHierarchy;
referencedNameHierarchy.push(std::make_shared<NameElement>(includedFilePath.fileName()));
NameHierarchy contextNameHierarchy;
contextNameHierarchy.push(std::make_shared<NameElement>(m_currentPath.fileName()));
m_client->recordReference(
REFERENCE_INCLUDE,
referencedNameHierarchy,
contextNameHierarchy,
getParseLocation(fileNameRange.getAsRange())
);
}
}
@@ -77,8 +85,12 @@ void PreprocessorCallbacks::MacroDefined(const clang::Token& macroNameToken, con
NameHierarchy nameHierarchy;
nameHierarchy.push(std::make_shared<NameElement>(macroNameToken.getIdentifierInfo()->getName().str()));
m_client->onMacroDefineParsed(
getParseLocation(macroNameToken), nameHierarchy, getParseLocation(macroDirective->getMacroInfo()));
m_client->recordSymbol(
nameHierarchy,
SYMBOL_MACRO,
getParseLocation(macroNameToken),
getParseLocation(macroDirective->getMacroInfo())
);
}
}
@@ -116,10 +128,20 @@ void PreprocessorCallbacks::onMacroUsage(const clang::Token& macroNameToken)
{
if (!m_currentPath.empty())
{
NameHierarchy nameHierarchy;
nameHierarchy.push(std::make_shared<NameElement>(macroNameToken.getIdentifierInfo()->getName().str()));
const ParseLocation loc = getParseLocation(macroNameToken);
m_client->onMacroExpandParsed(getParseLocation(macroNameToken), nameHierarchy);
NameHierarchy referencedNameHierarchy;
referencedNameHierarchy.push(std::make_shared<NameElement>(macroNameToken.getIdentifierInfo()->getName().str()));
NameHierarchy contextNameHierarchy;
contextNameHierarchy.push(std::make_shared<NameElement>(loc.filePath.fileName()));
m_client->recordReference(
REFERENCE_MACRO_USAGE,
referencedNameHierarchy,
contextNameHierarchy,
loc
);
}
}