Clang: Set LC_NUMERIC to "C" for clangbackend

The tidy check SuspiciousMissingCommaCheck uses the locale dependent
stod() when reading settings and might throw std::invalid_argument for a
locale different than "C".

Fixes: QTCREATORBUG-21605
Change-Id: I69bf719a8fd94e13ce67b46238f536c85ab2eaa3
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-12-07 14:35:26 +01:00
parent 6809848b23
commit 5719e7961e

View File

@@ -34,6 +34,7 @@
#include <clangcodemodelclientproxy.h>
#include <iostream>
#include <clocale>
using ClangBackEnd::ClangCodeModelClientProxy;
using ClangBackEnd::ClangCodeModelServer;
@@ -75,6 +76,10 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationVersion(QStringLiteral("1.0.0"));
QCoreApplication application(argc, argv);
// Some tidy checks use locale-dependent conversion functions and thus might throw exceptions.
std::setlocale(LC_NUMERIC, "C");
CrashHandlerSetup setupCrashHandler(QCoreApplication::applicationName(),
CrashHandlerSetup::DisableRestart);