Commit c88d18c3 authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

Clang: Print command line arguments quoted



Change-Id: I82d664f259040b0024d9e1d4df4235442bc6ac73
Reviewed-by: default avatarMarco Bubke <marco.bubke@theqtcompany.com>
parent 49958909
......@@ -30,6 +30,8 @@
#include "commandlinearguments.h"
#include <utf8string.h>
#include <iostream>
namespace ClangBackEnd {
......@@ -67,13 +69,23 @@ const char *CommandLineArguments::at(int position) const
return m_arguments.at(uint(position));
}
static Utf8String maybeQuoted(const char *argumentAsCString)
{
const auto quotationMark = Utf8StringLiteral("\"");
const auto argument = Utf8String::fromUtf8(argumentAsCString);
if (argument.contains(quotationMark))
return argument;
return quotationMark + argument + quotationMark;
}
void CommandLineArguments::print() const
{
using namespace std;
cerr << "Arguments to libclang:";
for (const auto &argument : m_arguments)
cerr << ' ' << argument;
cerr << ' ' << maybeQuoted(argument).constData();
cerr << endl;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment