aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools/cplusplus-shared/utils.h
blob: 7ff8e44fe55ffa024f062d71c1bdffb84b506a16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QString>
#include <QStringList>
#include <QMap>

namespace CplusplusToolsUtils {

void executeCommand(const QString &command, const QStringList &arguments, const QString &outputFile,
                    bool verbose = false);

// Preprocess a file by calling an external compiler in preprocessor mode (-E, /E).
class SystemPreprocessor
{
public:
    SystemPreprocessor(bool verbose = false);
    void preprocessFile(const QString &inputFile, const QString &outputFile) const;

private:
    void check() const;

    QMap<QString, QString> m_knownCompilers;
    QString m_compiler; // Compiler that will be called in preprocessor mode
    QStringList m_compilerArguments;
    bool m_verbose;
};

} // namespace