data: Added HeaderSearchPaths to Application- and ProjectSettings

This change allows for parsing of a real codebase by specifying the system header search paths in
ApplicationSettings.xml and the additional header search paths in ProjectSettings.xml.

Both settings files are now documented in ApplicationSettings_template.xml and ProjectSettings_template.xml, which show
all possible settings for each file.

This change also fixes some parsing edge cases that occured.
This commit is contained in:
Eberhard Graether
2014-10-07 12:11:48 +02:00
parent d720414467
commit f41e1c429d
23 changed files with 211 additions and 57 deletions
+34 -5
View File
@@ -13,12 +13,41 @@ CxxParser::~CxxParser()
{
}
void CxxParser::parseFiles(const std::vector<std::string>& filePaths)
{
// Fake commandline flags passed to the programm. Everything after '--' will be interpreted by the ClangTool.
void CxxParser::parseFiles(
const std::vector<std::string>& filePaths,
const std::vector<std::string>& systemHeaderSearchPaths,
const std::vector<std::string>& headerSearchPaths
){
// Commandline flags passed to the programm. Everything after '--' will be interpreted by the ClangTool.
std::vector<std::string> args;
args.push_back("app");
args.push_back("--");
// verbose
// args.push_back("-v");
// The option '-x c++' treats subsequent input files as C++.
const char* argv[] = { "app", "--", "-x", "c++" };
int argc = 4;
args.push_back("-x");
args.push_back("c++");
args.push_back("-std=c++11");
for (const std::string& path : systemHeaderSearchPaths)
{
args.push_back("-isystem" + path);
}
for (const std::string& path : headerSearchPaths)
{
args.push_back("-I" + path);
}
int argc = args.size();
const char** argv = new const char*[argc];
for (size_t i = 0; i < args.size(); i++)
{
argv[i] = args[i].c_str();
}
std::shared_ptr<clang::tooling::FixedCompilationDatabase> compilationDatabase(
clang::tooling::FixedCompilationDatabase::loadFromCommandLine(argc, argv)