Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpp_clang.cpp File Reference

(333baa13eb6cb8d549793fbd47786cefad5b496e)

#include "cpp_clang.h"
#include "clangtoolastreader.h"
#include "filesignificancecheck.h"
#include "lupdatepreprocessoraction.h"
#include "synchronized.h"
#include "translator.h"
#include <QLibraryInfo>
#include <QtCore/qdir.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qjsonarray.h>
#include <QtCore/qjsondocument.h>
#include <QtCore/qjsonobject.h>
#include <QtCore/qscopeguard.h>
#include <QtCore/QProcess>
#include <QStandardPaths>
#include <QtTools/private/qttools-config_p.h>
#include <clang/Tooling/CompilationDatabase.h>
#include <algorithm>
#include <limits>
#include <thread>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <memory>
#include <stdexcept>
#include <string>
#include <array>
+ Include dependency graph for cpp_clang.cpp:

Go to the source code of this file.

Macros

#define START_THREADS(RSV, WSV)
 
#define JOIN_THREADS(WSV)
 

Functions

 Q_LOGGING_CATEGORY (lcClang, "qt.lupdate.clang")
 
static QString getSysCompiler ()
 
static QByteArrayList getMSVCIncludePathsFromEnvironment ()
 
static QStringList getProjectDirsFromEnvironment ()
 
static QByteArray frameworkSuffix ()
 
QByteArrayList getIncludePathsFromCompiler ()
 
static clang::tooling::ArgumentsAdjuster getClangArgumentAdjuster ()
 
static bool generateCompilationDatabase (const QString &outputFilePath, const ConversionData &cd)
 
static void sortMessagesByFileOrder (ClangCppParser::TranslatorMessageVector &messages, const QStringList &files)
 
static QString ensureCanonicalPath (const QString &filePath)
 

Variables

static std::vector< std::stringaliasDefinition
 

Macro Definition Documentation

◆ JOIN_THREADS

#define JOIN_THREADS ( WSV)
Value:
WSV.emplace_back(std::move(store)); \
} \
}); \
producers.emplace_back(std::move(producer)); \
} \
\
for (auto &producer : producers) \
producer.join();

Definition at line 688 of file cpp_clang.cpp.

◆ START_THREADS

#define START_THREADS ( RSV,
WSV )
Value:
std::vector<std::thread> producers; \
const size_t idealProducerCount = std::min(RSV.size(), size_t(std::thread::hardware_concurrency())); \
\
for (size_t i = 0; i < idealProducerCount; ++i) { \
std::thread producer([&]() { \
while (RSV.next(&store)) { \
if (!store.contextArg.isEmpty()) { \
WSV.emplace_back(std::move(store)); \
continue; \
}
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:198

Definition at line 675 of file cpp_clang.cpp.

Function Documentation

◆ ensureCanonicalPath()

static QString ensureCanonicalPath ( const QString & filePath)
static

Definition at line 628 of file cpp_clang.cpp.

◆ frameworkSuffix()

static QByteArray frameworkSuffix ( )
static

Definition at line 97 of file cpp_clang.cpp.

◆ generateCompilationDatabase()

static bool generateCompilationDatabase ( const QString & outputFilePath,
const ConversionData & cd )
static

Definition at line 330 of file cpp_clang.cpp.

◆ getClangArgumentAdjuster()

static clang::tooling::ArgumentsAdjuster getClangArgumentAdjuster ( )
static

Definition at line 243 of file cpp_clang.cpp.

◆ getIncludePathsFromCompiler()

QByteArrayList getIncludePathsFromCompiler ( )

Definition at line 102 of file cpp_clang.cpp.

◆ getMSVCIncludePathsFromEnvironment()

static QByteArrayList getMSVCIncludePathsFromEnvironment ( )
static

Definition at line 68 of file cpp_clang.cpp.

◆ getProjectDirsFromEnvironment()

static QStringList getProjectDirsFromEnvironment ( )
static

Definition at line 81 of file cpp_clang.cpp.

◆ getSysCompiler()

static QString getSysCompiler ( )
static

Definition at line 44 of file cpp_clang.cpp.

◆ Q_LOGGING_CATEGORY()

Q_LOGGING_CATEGORY ( lcClang ,
"qt.lupdate.clang"  )

◆ sortMessagesByFileOrder()

static void sortMessagesByFileOrder ( ClangCppParser::TranslatorMessageVector & messages,
const QStringList & files )
static

Definition at line 369 of file cpp_clang.cpp.

References TranslatorMessage::lineNumber().

+ Here is the call graph for this function:

Variable Documentation

◆ aliasDefinition

static std::vector< std::string > aliasDefinition
static

Definition at line 241 of file cpp_clang.cpp.