Apply clang-format

This commit is contained in:
Martchus 2017-11-18 00:27:25 +01:00
parent add8ddaeec
commit 69d4fa193f
3 changed files with 9 additions and 8 deletions

View File

@ -25,7 +25,8 @@ CodeFactory::ToolInvocation::ToolInvocation(CodeFactory &factory)
fileManager.Retain(); fileManager.Retain();
} }
CodeFactory::CodeFactory(const char *applicationPath, const std::vector<const char *> &sourceFiles, const std::vector<string> &clangOptions, std::ostream &os) CodeFactory::CodeFactory(
const char *applicationPath, const std::vector<const char *> &sourceFiles, const std::vector<string> &clangOptions, std::ostream &os)
: m_applicationPath(applicationPath) : m_applicationPath(applicationPath)
, m_sourceFiles(sourceFiles) , m_sourceFiles(sourceFiles)
, m_clangOptions(clangOptions) , m_clangOptions(clangOptions)

View File

@ -67,21 +67,20 @@ int main(int argc, char *argv[])
// compose options passed to the clang tool invocation // compose options passed to the clang tool invocation
vector<string> clangOptions; vector<string> clangOptions;
if(clangOptionsArg.isPresent()) { if (clangOptionsArg.isPresent()) {
// add additional options specified via CLI argument // add additional options specified via CLI argument
for(const auto *const value : clangOptionsArg.values(0)) { for (const auto *const value : clangOptionsArg.values(0)) {
// split options by ";" - not nice but this eases using CMake generator expressions // split options by ";" - not nice but this eases using CMake generator expressions
const auto splittedValues(splitString<vector<string>>(value, ";", EmptyPartsTreat::Omit)); const auto splittedValues(splitString<vector<string>>(value, ";", EmptyPartsTreat::Omit));
clangOptions.reserve(clangOptions.size() + splittedValues.size()); clangOptions.reserve(clangOptions.size() + splittedValues.size());
for(const auto &splittedValue : splittedValues) { for (const auto &splittedValue : splittedValues) {
clangOptions.emplace_back(move(splittedValue)); clangOptions.emplace_back(move(splittedValue));
} }
} }
} }
// configure code generator // configure code generator
CodeFactory factory( CodeFactory factory(parser.executable(), inputFileArg.values(0), clangOptions, *os);
parser.executable(), inputFileArg.values(0), clangOptions, *os);
// add only specified generators if the --generator argument is present // add only specified generators if the --generator argument is present
if (generatorsArg.isPresent()) { if (generatorsArg.isPresent()) {
// find and construct generators by name // find and construct generators by name

View File

@ -65,7 +65,7 @@ void JsonGeneratorTests::testGeneratorItself()
{ {
const string inputFilePath(testFilePath("some_structs.h")); const string inputFilePath(testFilePath("some_structs.h"));
const vector<const char *> inputFiles{ inputFilePath.data() }; const vector<const char *> inputFiles{ inputFilePath.data() };
const vector<string> clangOptions{"-I" CPP_UTILITIES_INCLUDE_DIRS, "-I" RAPIDJSON_INCLUDE_DIRS}; const vector<string> clangOptions{ "-I" CPP_UTILITIES_INCLUDE_DIRS, "-I" RAPIDJSON_INCLUDE_DIRS };
stringstream buffer; stringstream buffer;
JsonSerializationCodeGenerator::Options jsonOptions; JsonSerializationCodeGenerator::Options jsonOptions;
@ -88,7 +88,8 @@ void JsonGeneratorTests::testCLI()
string stdout, stderr; string stdout, stderr;
const string inputFilePath(testFilePath("some_structs.h")); const string inputFilePath(testFilePath("some_structs.h"));
const char *const args1[] = { PROJECT_NAME, "-i", inputFilePath.data(), "--json-classes", "TestNamespace2::ThirdPartyStruct", "--clang-opt", "-I" CPP_UTILITIES_INCLUDE_DIRS, "-I" RAPIDJSON_INCLUDE_DIRS, nullptr }; const char *const args1[] = { PROJECT_NAME, "-i", inputFilePath.data(), "--json-classes", "TestNamespace2::ThirdPartyStruct", "--clang-opt",
"-I" CPP_UTILITIES_INCLUDE_DIRS, "-I" RAPIDJSON_INCLUDE_DIRS, nullptr };
TESTUTILS_ASSERT_EXEC(args1); TESTUTILS_ASSERT_EXEC(args1);
assertEqualityLinewise(m_expectedCode, toArrayOfLines(stdout)); assertEqualityLinewise(m_expectedCode, toArrayOfLines(stdout));
#endif #endif