forked from qt-creator/qt-creator
Don't put QString in static attributes
It crashed in some places on our code-base due to the so-called "static initialization order fiasco". As a solution, it turns the variable into a function. This shouldn't have a penalty due to QStringLiteral. Change-Id: I9f8a955afdff878dc2f0db16fec861d81250c243 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
committed by
Aleix Pol Gonzalez
parent
954cabdde8
commit
b899684a89
@@ -734,7 +734,7 @@ void Preprocessor::State::updateIncludeGuardState_helper(IncludeGuardStateHint h
|
||||
#endif // DEBUG_INCLUDE_GUARD_TRACKING
|
||||
}
|
||||
|
||||
const QString Preprocessor::configurationFileName = QLatin1String("<configuration>");
|
||||
QString Preprocessor::configurationFileName() { return QStringLiteral("<configuration>"); }
|
||||
|
||||
Preprocessor::Preprocessor(Client *client, Environment *env)
|
||||
: m_client(client)
|
||||
@@ -1978,7 +1978,7 @@ void Preprocessor::handleIfDefDirective(bool checkUndefined, PPToken *tk)
|
||||
|
||||
// the macro is a feature constraint(e.g. QT_NO_XXX)
|
||||
if (checkUndefined && macroName.startsWith("QT_NO_")) {
|
||||
if (macro->fileName() == configurationFileName) {
|
||||
if (macro->fileName() == configurationFileName()) {
|
||||
// and it' defined in a pro file (e.g. DEFINES += QT_NO_QOBJECT)
|
||||
|
||||
value = false; // take the branch
|
||||
|
||||
@@ -77,7 +77,7 @@ class CPLUSPLUS_EXPORT Preprocessor
|
||||
typedef Internal::Value Value;
|
||||
|
||||
public:
|
||||
static const QString configurationFileName;
|
||||
static QString configurationFileName();
|
||||
|
||||
public:
|
||||
Preprocessor(Client *client, Environment *env);
|
||||
|
||||
Reference in New Issue
Block a user