build: merge Coati app and Trial to single executable

* removed trial target
* updated deploy scripts to exclude trial
* cleanup CMakeLists
* removed Eigen dependencies
* split parser lib into lib_cxx and lib_java
* added ProjectFactory and ProjectFactoryModules
* removed old installer projects
* updated wix installer
  * updated readme for wix setup
  * updated to use obfuscated exe
  * added qt.conf
  * added indexing dialog images
  * added jars
  * added coatidb files of sample projects
  * added source code of javaparser sample
  * removed auto-refresh image
  * intermediate files of windows installer are created in build folder
  * preselected desktop shortcut
  * build bat is executed from deploy_windows script
This commit is contained in:
malte_langkabel
2016-09-16 12:45:00 +02:00
parent 8fcb35611d
commit 3b7baba24b
140 changed files with 869 additions and 22250 deletions
@@ -0,0 +1,171 @@
#include "data/parser/cxx/PreprocessorCallbacks.h"
#include "clang/Driver/Util.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Lex/MacroArgs.h"
#include "utility/file/FileRegister.h"
#include "data/parser/ParserClient.h"
#include "data/parser/ParseLocation.h"
PreprocessorCallbacks::PreprocessorCallbacks(
clang::SourceManager& sourceManager, ParserClient* client, FileRegister* fileRegister
)
: m_sourceManager(sourceManager)
, m_client(client)
, m_fileRegister(fileRegister)
{
}
void PreprocessorCallbacks::FileChanged(
clang::SourceLocation location, FileChangeReason reason, clang::SrcMgr::CharacteristicKind, clang::FileID prevID)
{
FilePath filePath;
const clang::FileEntry *fileEntry = m_sourceManager.getFileEntryForID(m_sourceManager.getFileID(location));
if (fileEntry)
{
filePath = FilePath(fileEntry->getName()).canonical();
}
if (!filePath.empty() && m_fileRegister->hasFilePath(filePath) && !m_fileRegister->fileIsParsed(filePath))
{
m_currentPath = filePath;
if (reason == EnterFile && !m_fileRegister->includeFileIsParsed(filePath))
{
m_client->onFileParsed(m_fileRegister->getFileInfo(filePath));
m_fileRegister->markIncludeFileParsing(filePath);
}
}
else
{
m_currentPath = FilePath();
}
}
void PreprocessorCallbacks::InclusionDirective(
clang::SourceLocation hashLocation, const clang::Token& includeToken, llvm::StringRef fileName, bool isAngled,
clang::CharSourceRange fileNameRange, const clang::FileEntry* fileEntry, llvm::StringRef searchPath,
llvm::StringRef relativePath, const clang::Module* imported
){
if (!m_currentPath.empty() && fileEntry)
{
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)
);
}
}
}
void PreprocessorCallbacks::MacroDefined(const clang::Token& macroNameToken, const clang::MacroDirective* macroDirective)
{
if (!m_currentPath.empty())
{
// ignore builtin macros
if (m_sourceManager.getSpellingLoc(macroNameToken.getLocation()).printToString(m_sourceManager)[0] == '<')
{
return;
}
NameHierarchy nameHierarchy;
nameHierarchy.push(std::make_shared<NameElement>(macroNameToken.getIdentifierInfo()->getName().str()));
m_client->onMacroDefineParsed(
getParseLocation(macroNameToken), nameHierarchy, getParseLocation(macroDirective->getMacroInfo()));
}
}
void PreprocessorCallbacks::MacroUndefined(
const clang::Token& macroNameToken, const clang::MacroDefinition& macroDefinition)
{
onMacroUsage(macroNameToken);
}
void PreprocessorCallbacks::Defined(
const clang::Token& macroNameToken, const clang::MacroDefinition& macroDefinition, clang::SourceRange range)
{
onMacroUsage(macroNameToken);
}
void PreprocessorCallbacks::Ifdef(clang::SourceLocation location, const clang::Token& macroNameToken,
const clang::MacroDefinition& macroDefinition)
{
onMacroUsage(macroNameToken);
}
void PreprocessorCallbacks::Ifndef(clang::SourceLocation location, const clang::Token& macroNameToken,
const clang::MacroDefinition& macroDefinition)
{
onMacroUsage(macroNameToken);
}
void PreprocessorCallbacks::MacroExpands(
const clang::Token& macroNameToken, const clang::MacroDefinition& macroDirective,
clang::SourceRange range, const clang::MacroArgs* args
){
onMacroUsage(macroNameToken);
}
void PreprocessorCallbacks::onMacroUsage(const clang::Token& macroNameToken)
{
if (!m_currentPath.empty())
{
NameHierarchy nameHierarchy;
nameHierarchy.push(std::make_shared<NameElement>(macroNameToken.getIdentifierInfo()->getName().str()));
m_client->onMacroExpandParsed(getParseLocation(macroNameToken), nameHierarchy);
}
}
ParseLocation PreprocessorCallbacks::getParseLocation(const clang::Token& macroNameTok) const
{
const clang::SourceLocation& location = m_sourceManager.getSpellingLoc(macroNameTok.getLocation());
const clang::SourceLocation& endLocation = m_sourceManager.getSpellingLoc(macroNameTok.getEndLoc());
return ParseLocation(
m_sourceManager.getFilename(location),
m_sourceManager.getSpellingLineNumber(location),
m_sourceManager.getSpellingColumnNumber(location),
m_sourceManager.getSpellingLineNumber(endLocation),
m_sourceManager.getSpellingColumnNumber(endLocation) - 1
);
}
ParseLocation PreprocessorCallbacks::getParseLocation(const clang::MacroInfo* macroInfo) const
{
clang::SourceLocation location = macroInfo->getDefinitionLoc();
clang::SourceLocation endLocation = macroInfo->getDefinitionEndLoc();
return ParseLocation(
m_sourceManager.getFilename(location),
m_sourceManager.getSpellingLineNumber(location),
m_sourceManager.getSpellingColumnNumber(location),
m_sourceManager.getSpellingLineNumber(endLocation),
m_sourceManager.getSpellingColumnNumber(endLocation) - 1
);
}
ParseLocation PreprocessorCallbacks::getParseLocation(const clang::SourceRange& sourceRange) const
{
if (sourceRange.isInvalid())
{
return ParseLocation();
}
const clang::PresumedLoc& presumedBegin = m_sourceManager.getPresumedLoc(sourceRange.getBegin(), false);
const clang::PresumedLoc& presumedEnd = m_sourceManager.getPresumedLoc(sourceRange.getEnd(), false);
return ParseLocation(
presumedBegin.getFilename(),
presumedBegin.getLine(),
presumedBegin.getColumn(),
presumedEnd.getLine(),
presumedEnd.getColumn() - 1
);
}