mirror of https://github.com/qt/qtbase.git
QLibraryInfo: de-pessimize prefixFromAppDirHelper()
The local appDir variable was only used to hold the return value of
another function call. But hardly any compiler will be able to look
through the QString atomic ref-counting to turn the non-Darwin code
paths into the tail-calls that they ought to be.
Remove the variable and return the result immediately. This removes
the move-assignment and dtor calls in the two changed lines and lets
RVO kick in, turning these calls into tail-calls on non-Darwin
platforms.
Amends 4ac872639e
.
Pick-to: 6.9 6.8 6.5
Change-Id: Ieeefbd52fc983ab7aebcff6419965b206f374935
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit is contained in:
parent
8bf5438531
commit
e57113feac
|
@ -269,8 +269,6 @@ QVersionNumber QLibraryInfo::version() noexcept
|
|||
|
||||
static QString prefixFromAppDirHelper()
|
||||
{
|
||||
QString appDir;
|
||||
|
||||
if (QCoreApplication::instance()) {
|
||||
#ifdef Q_OS_DARWIN
|
||||
CFBundleRef bundleRef = CFBundleGetMainBundle();
|
||||
|
@ -289,12 +287,10 @@ static QString prefixFromAppDirHelper()
|
|||
}
|
||||
#endif // Q_OS_DARWIN
|
||||
// We make the prefix path absolute to the executable's directory.
|
||||
appDir = QCoreApplication::applicationDirPath();
|
||||
return QCoreApplication::applicationDirPath();
|
||||
} else {
|
||||
appDir = QDir::currentPath();
|
||||
return QDir::currentPath();
|
||||
}
|
||||
|
||||
return appDir;
|
||||
}
|
||||
|
||||
#if QT_CONFIG(relocatable)
|
||||
|
|
Loading…
Reference in New Issue