Commit 3e593779 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Clang: Properly quote arguments

Change-Id: Id51bc93de028429f18fca1638b1db4051880971b
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent 3ecbce9b
......@@ -28,6 +28,7 @@
#include "clangfilepath.h"
#include <utf8string.h>
#include <utils/qtcprocess.h>
#include <QByteArray>
......@@ -71,13 +72,10 @@ const char *CommandLineArguments::at(int position) const
static Utf8String maybeQuoted(const char *argumentAsCString)
{
const auto quotationMark = Utf8StringLiteral("\"");
const auto argument = Utf8String::fromUtf8(argumentAsCString);
const QString argumentAsQString = QString::fromUtf8(argumentAsCString);
const QString quotedArgument = Utils::QtcProcess::quoteArg(argumentAsQString);
if (argument.contains(quotationMark))
return argument;
return quotationMark + argument + quotationMark;
return Utf8String::fromString(quotedArgument);
}
void CommandLineArguments::print() const
......
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