From 53211ec19e9c85c28bf4aa8a1bb09191806dfc65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lucie=20G=C3=A9rard?= <lucie.gerard@qt.io>
Date: Tue, 1 Oct 2019 09:01:10 +0200
Subject: [PATCH] Revert "Add empty clangcpp parser functionality"

The functionality got moved to dev.
This reverts commit a79eaba195f3b235b4c8db79caa75e42b38664a8.

Task-number: QTBUG-78875
Change-Id: Iaccdfb9fe2e6a56eba9baf3d44961382834139eb
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
---
 src/linguist/lupdate/cpp_clang.cpp | 62 ------------------------------
 src/linguist/lupdate/cpp_clang.h   | 45 ----------------------
 src/linguist/lupdate/lupdate.pro   |  4 +-
 src/linguist/lupdate/main.cpp      | 15 +-------
 4 files changed, 2 insertions(+), 124 deletions(-)
 delete mode 100644 src/linguist/lupdate/cpp_clang.cpp
 delete mode 100644 src/linguist/lupdate/cpp_clang.h

diff --git a/src/linguist/lupdate/cpp_clang.cpp b/src/linguist/lupdate/cpp_clang.cpp
deleted file mode 100644
index 198724f50..000000000
--- a/src/linguist/lupdate/cpp_clang.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Linguist of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "cpp_clang.h"
-
-#include <translator.h>
-
-QT_BEGIN_NAMESPACE
-
-void ClangCppParser::loadCPP(Translator &translator, const QStringList &filenames,
-    ConversionData &cd)
-{
-    // Going through the files to be parsed
-    std::vector<std::string> sources;
-    for (const QString &filename: filenames)
-       sources.push_back(filename.toStdString());
-
-    // The ClangTool is to be created and run from this function.
-
-    // First we'll need an OptionParser
-    // Then we'll create a ClangTool taking the OptionParser and the sources as argument
-
-    // The translator to store the information from the parsing of the files.
-    Translator *tor = new Translator();
-
-    // TODO: set up clang tool for parsing
-    qWarning("lupdate: Clang based C++ parser not implemented!");
-
-    // TODO: remove this printing at a later point
-    // Printing the translator (storage and manipulation of translation info from linguist module)
-    if (qEnvironmentVariableIsSet("QT_LUPDATE_CLANG_DEBUG"))
-        tor->dump();
-
-    for (const TranslatorMessage &msg: tor->messages())
-        translator.extend(msg, cd);
-
-}
-QT_END_NAMESPACE
diff --git a/src/linguist/lupdate/cpp_clang.h b/src/linguist/lupdate/cpp_clang.h
deleted file mode 100644
index d4357f129..000000000
--- a/src/linguist/lupdate/cpp_clang.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Linguist of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CLANG_CPP_H
-#define CLANG_CPP_H
-
-#include "lupdate.h"
-
-
-QT_BEGIN_NAMESPACE
-
-namespace ClangCppParser {
-   void loadCPP(Translator &translator, const QStringList &filenames,
-   ConversionData &cd);
-}
-
-QT_END_NAMESPACE
-
-
-#endif
diff --git a/src/linguist/lupdate/lupdate.pro b/src/linguist/lupdate/lupdate.pro
index 615b41802..e69703da2 100644
--- a/src/linguist/lupdate/lupdate.pro
+++ b/src/linguist/lupdate/lupdate.pro
@@ -21,15 +21,13 @@ SOURCES += \
     \
     cpp.cpp \
     java.cpp \
-    ui.cpp \
-    cpp_clang.cpp
+    ui.cpp
 
 qtHaveModule(qmldevtools-private): SOURCES += qdeclarative.cpp
 
 HEADERS += \
     lupdate.h \
     cpp.h \
-    cpp_clang.h \
     ../shared/projectdescriptionreader.h \
     ../shared/qrcreader.h \
     ../shared/runqttool.h \
diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp
index 5ab3f59b9..712b95550 100644
--- a/src/linguist/lupdate/main.cpp
+++ b/src/linguist/lupdate/main.cpp
@@ -28,7 +28,6 @@
 ****************************************************************************/
 
 #include "lupdate.h"
-#include "cpp_clang.h"
 
 #include <profileutils.h>
 #include <projectdescriptionreader.h>
@@ -48,8 +47,6 @@
 
 #include <iostream>
 
-bool useClangToParseCpp = false;
-
 // Can't have an array of QStaticStringData<N> for different N, so
 // use QString, which requires constructor calls. Doesn't matter
 // much, since this is in an app, not a lib:
@@ -278,9 +275,6 @@ static void printUsage()
         "           Specify the output file(s). This will override the TRANSLATIONS.\n"
         "    -version\n"
         "           Display the version of lupdate and exit.\n"
-        "    -clang-parser \n"
-        "           Use clang to parse cpp files. Otherwise a custom parser is used.\n"
-        "           Need a compile_commands.json for the files that needs to be parsed.\n"
         "    @lst-file\n"
         "           Read additional file names (one per line) or includepaths (one per\n"
         "           line, and prefixed with -I) from lst-file.\n"
@@ -519,11 +513,7 @@ static void processSources(Translator &fetchedTor,
         printErr(LU::tr("lupdate warning: Some files have been ignored due to missing qml/javascript support\n"));
 #endif
 
-    if (useClangToParseCpp)
-        ClangCppParser::loadCPP(fetchedTor, sourceFilesCpp, cd);
-    else
-        loadCPP(fetchedTor, sourceFilesCpp, cd);
-
+    loadCPP(fetchedTor, sourceFilesCpp, cd);
     if (!cd.error().isEmpty())
         printErr(cd.error());
 }
@@ -843,9 +833,6 @@ int main(int argc, char **argv)
                 includePath += args[i].mid(2);
             }
             continue;
-        } else if (arg == QLatin1String("-clang-parser")) {
-            useClangToParseCpp = true;
-            continue;
         } else if (arg.startsWith(QLatin1String("-")) && arg != QLatin1String("-")) {
             printErr(LU::tr("Unrecognized option '%1'.\n").arg(arg));
             return 1;
-- 
GitLab