diff --git a/src/mapleall/maple_driver/BUILD.gn b/src/mapleall/maple_driver/BUILD.gn index 162a90a1eef61e304980d7236cd132f5039b1486..41451906c55245bead53c50934bff464042f7417 100644 --- a/src/mapleall/maple_driver/BUILD.gn +++ b/src/mapleall/maple_driver/BUILD.gn @@ -49,6 +49,8 @@ executable("maple") { "src/file_utils.cpp", "src/ipa_compiler.cpp", "src/jbc2mpl_compiler.cpp", + "src/cpp2mpl_compiler.cpp", + "src/clang_compiler.cpp", "src/ld_compiler.cpp", "src/maple.cpp", "src/maple_comb_compiler.cpp", diff --git a/src/mapleall/maple_driver/defs/default/O0_options_clang.def b/src/mapleall/maple_driver/defs/default/O0_options_clang.def new file mode 100644 index 0000000000000000000000000000000000000000..a8edd35c27eedc345376e3e34eabae6a4e7ac976 --- /dev/null +++ b/src/mapleall/maple_driver/defs/default/O0_options_clang.def @@ -0,0 +1,2 @@ +{"-emit-ast", "", false}, +{"-o", "", false}, \ No newline at end of file diff --git a/src/mapleall/maple_driver/defs/default/O0_options_cpp2mpl.def b/src/mapleall/maple_driver/defs/default/O0_options_cpp2mpl.def new file mode 100644 index 0000000000000000000000000000000000000000..8e7a8d13e19d4d53c7ce933e50011efc2502ff84 --- /dev/null +++ b/src/mapleall/maple_driver/defs/default/O0_options_cpp2mpl.def @@ -0,0 +1,2 @@ +{"--in-ast", "", false} + diff --git a/src/mapleall/maple_driver/defs/default_options.def b/src/mapleall/maple_driver/defs/default_options.def index da1f2d9b99e8c22695a44c0ba915412cda46cbb7..7c5fac10850732261caaeda71f3bce8cad73f0fb 100644 --- a/src/mapleall/maple_driver/defs/default_options.def +++ b/src/mapleall/maple_driver/defs/default_options.def @@ -108,5 +108,13 @@ static MplOption kMeDefaultOptionsO2ForC[] = { static MplOption kMplcgDefaultOptionsO2ForC[] = { #include "default/O2_options_mplcg_c.def" }; +// O0 cpp2mpl options +static MplOption kCpp2MplDefaultOptionsForAst[] = { +#include "default/O0_options_cpp2mpl.def" +}; +// O0 clang options +static MplOption kClangDefaultOptions[] = { +#include "default/O0_options_clang.def" +}; } // namespace maple #endif // MAPLE_DRIVER_INCLUDE_DEFAULT_OPTIONS_H diff --git a/src/mapleall/maple_driver/include/as_option.h b/src/mapleall/maple_driver/include/as_option.h new file mode 100644 index 0000000000000000000000000000000000000000..cb75e589e60cdb15240c5509b085e4e6d00c0c5e --- /dev/null +++ b/src/mapleall/maple_driver/include/as_option.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. + * + * OpenArkCompiler is licensed under Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * + * http://license.coscl.org.cn/MulanPSL2 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR + * FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ +#ifndef MAPLE_AS_OPTION_H +#define MAPLE_AS_OPTION_H +#include "option_descriptor.h" + +namespace maple { +enum AsOptionIndex { + kAsHelp, +}; + +const mapleOption::Descriptor asUsage[] = { + { kUnknown, 0, "", "", mapleOption::kBuildTypeAll, mapleOption::kArgCheckPolicyUnknown, + "========================================\n" + " Usage: as [ options ]\n" + " options:\n", + "as", + {} }, + + + { kAsHelp, 0, "h", "help", mapleOption::kBuildTypeExperimental, mapleOption::kArgCheckPolicyNone, + " -h, --help : print usage and exit.\n", + "as", + {} }, + + { kUnknown, 0, "", "", mapleOption::kBuildTypeAll, mapleOption::kArgCheckPolicyNone, + "", + "as", + {} } +}; +} // namespace maple +#endif // MAPLE_AS_OPTION_H \ No newline at end of file diff --git a/src/mapleall/maple_driver/include/compiler.h b/src/mapleall/maple_driver/include/compiler.h index 54ce62a65f0e922b9926f9824edaaa8e638c1f70..4f3e4339e2a2a633d7b28ea92367a1e275e23077 100644 --- a/src/mapleall/maple_driver/include/compiler.h +++ b/src/mapleall/maple_driver/include/compiler.h @@ -32,19 +32,22 @@ namespace maple { const std::string kBinNameNone = ""; const std::string kBinNameJbc2mpl = "jbc2mpl"; +const std::string kBinNameCpp2mpl = "mplfe"; +const std::string kBinNameClang = "clang"; const std::string kBinNameDex2mpl = "dex2mpl"; const std::string kBinNameMplipa = "mplipa"; const std::string kBinNameMe = "me"; const std::string kBinNameMpl2mpl = "mpl2mpl"; const std::string kBinNameMplcg = "mplcg"; const std::string kBinNameMapleComb = "maplecomb"; -const std::string kBinNameAs = "as"; const std::string kBinNameLd = "ld"; const std::string kMachine = "aarch64-"; const std::string kVendor = "unknown-"; const std::string kOperatingSystem = "linux-gnu-"; const std::string kGccFlag = "gcc"; const std::string kGppFlag = "g++"; +const std::string kAsFlag = "as"; +const std::string kBinNameAs = kMachine + kOperatingSystem + kAsFlag; const std::string kBinNameGcc = kMachine + kOperatingSystem + kGccFlag; const std::string kBinNameGpp = kMachine + kOperatingSystem + kGppFlag; @@ -113,6 +116,35 @@ class Jbc2MplCompiler : public Compiler { std::unordered_set GetFinalOutputs(const MplOptions &mplOptions) const override; }; +class ClangCompiler : public Compiler { + public: + explicit ClangCompiler(const std::string &name) : Compiler(name) {} + + ~ClangCompiler() = default; + + private: + const std::string &GetBinName() const override; + std::string GetBinPath(const MplOptions &options) const override; + DefaultOption GetDefaultOptions(const MplOptions &options) const override; + void GetTmpFilesToDelete(const MplOptions &mplOptions, std::vector &tempFiles) const override; + std::unordered_set GetFinalOutputs(const MplOptions &mplOptions) const override ; +}; + +class Cpp2MplCompiler : public Compiler { + public: + explicit Cpp2MplCompiler(const std::string &name) : Compiler(name) {} + + ~Cpp2MplCompiler() = default; + +private: + std::string GetBinPath(const MplOptions &options) const override; + const std::string &GetBinName() const override; + std::string GetInputFileName(const MplOptions &options) const override; + DefaultOption GetDefaultOptions(const MplOptions &options) const override; + void GetTmpFilesToDelete(const MplOptions &mplOptions, std::vector &tempFiles) const override; + std::unordered_set GetFinalOutputs(const MplOptions &mplOptions) const override; +}; + class Dex2MplCompiler : public Compiler { public: explicit Dex2MplCompiler(const std::string &name) : Compiler(name) {} diff --git a/src/mapleall/maple_driver/include/cpp2mpl_option.h b/src/mapleall/maple_driver/include/cpp2mpl_option.h new file mode 100644 index 0000000000000000000000000000000000000000..d6dc4541254fa89c57a04e8d733464175a406027 --- /dev/null +++ b/src/mapleall/maple_driver/include/cpp2mpl_option.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. + * + * OpenArkCompiler is licensed under Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * + * http://license.coscl.org.cn/MulanPSL2 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR + * FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ +#ifndef MAPLE_CPP2MPL_OPTION_H +#define MAPLE_CPP2MPL_OPTION_H +#include "option_descriptor.h" + +namespace maple { +enum CppOptionIndex { + kInAst, + kCpp2mplHelp, +}; + +const mapleOption::Descriptor cppUsage[] = { + { kUnknown, 0, "", "", mapleOption::kBuildTypeAll, mapleOption::kArgCheckPolicyUnknown, + "========================================\n" + " Usage: mplfe [ options ]\n" + " options:\n", + "mplfe", + {} }, + + { kInAst, 0, "", "inast", mapleOption::kBuildTypeAll, mapleOption::kArgCheckPolicyRequired, + " -inast file1.ast,file2.ast\n" + " : input ast files", + "c2mpl", + {} }, + + { kCpp2mplHelp, 0, "h", "help", mapleOption::kBuildTypeExperimental, mapleOption::kArgCheckPolicyNone, + " -h, --help : print usage and exit.\n", + "mplfe", + {} }, + + { kUnknown, 0, "", "", mapleOption::kBuildTypeAll, mapleOption::kArgCheckPolicyNone, + "", + "mplfe", + {} } +}; +} // namespace maple + +#endif //MAPLE_CPP2MPL_OPTION_H + diff --git a/src/mapleall/maple_driver/include/driver_option_common.h b/src/mapleall/maple_driver/include/driver_option_common.h index 55a8223e0c38b08f65eec3e2f2a39115087d25db..4a4e0761d3eefccc373309e4286e9e8a39367527 100644 --- a/src/mapleall/maple_driver/include/driver_option_common.h +++ b/src/mapleall/maple_driver/include/driver_option_common.h @@ -28,6 +28,8 @@ enum DriverOptionIndex { kOptimization2, kWithIpa, kJbc2mplOpt, + kCpp2mplOpt, + kAsOpt, kDex2mplOpt, kMplipaOpt, kVerify, diff --git a/src/mapleall/maple_driver/include/mpl_options.h b/src/mapleall/maple_driver/include/mpl_options.h index c02fa688425f5f1b2fae1f41ff40f8671afd6bb1..6fed0f48994e2c63e09050c4bc8252f453ee3cb1 100644 --- a/src/mapleall/maple_driver/include/mpl_options.h +++ b/src/mapleall/maple_driver/include/mpl_options.h @@ -33,6 +33,9 @@ enum InputFileType { kFileTypeNone, kFileTypeClass, kFileTypeJar, + kFileTypeAst, + kFileTypeCpp, + kFileTypeC, kFileTypeDex, kFileTypeMpl, kFileTypeVtableImplMpl, diff --git a/src/mapleall/maple_driver/src/as_compiler.cpp b/src/mapleall/maple_driver/src/as_compiler.cpp index 664d327f359a6689ca1ae1accc76f10aba5b0f3e..7f6e6b4f6a8ec630e41503b8ed48d4a9213ffbd8 100644 --- a/src/mapleall/maple_driver/src/as_compiler.cpp +++ b/src/mapleall/maple_driver/src/as_compiler.cpp @@ -20,12 +20,12 @@ std::string AsCompiler::GetBinPath(const MplOptions&) const { #ifdef ANDROID return "prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/"; #else - return std::string(kMapleRoot) + "/third-party/ndk/toolchain/bin/"; + return std::string(std::getenv(kMapleRoot)) + "/tools/gcc-linaro-7.5.0/bin/"; #endif } const std::string &AsCompiler::GetBinName() const { - return kBinNameGcc; + return kBinNameAs; } DefaultOption AsCompiler::GetDefaultOptions(const MplOptions&) const { @@ -34,7 +34,7 @@ DefaultOption AsCompiler::GetDefaultOptions(const MplOptions&) const { } std::string AsCompiler::GetInputFileName(const MplOptions &options) const { - return options.GetOutputFolder() + options.GetOutputName() + ".VtableImpl.s"; + return options.GetOutputFolder() + options.GetOutputName() + ".s"; } void AsCompiler::GetTmpFilesToDelete(const MplOptions &mplOptions, std::vector &tempFiles) const { diff --git a/src/mapleall/maple_driver/src/clang_compiler.cpp b/src/mapleall/maple_driver/src/clang_compiler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2789ddaf81424aaaca2712c254dac9d080f17e0c --- /dev/null +++ b/src/mapleall/maple_driver/src/clang_compiler.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) [2019-2021] Huawei Technologies Co.,Ltd.All rights reserved. + * + * OpenArkCompiler is licensed under Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * + * http://license.coscl.org.cn/MulanPSL2 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR + * FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ +#include +#include "compiler.h" +#include "file_utils.h" +#include "mpl_timer.h" +#include "default_options.def" + +namespace maple { + + +std::string ClangCompiler::GetBinPath(const MplOptions&) const{ + return std::string(std::getenv(kMapleRoot)) + "/tools/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/"; +} + +const std::string &ClangCompiler::GetBinName() const { + return kBinNameClang; +} + +DefaultOption ClangCompiler::GetDefaultOptions(const MplOptions &options) const { + DefaultOption defaultOptions = { nullptr, 0 }; + defaultOptions.mplOptions = kClangDefaultOptions; + defaultOptions.mplOptions[1].SetValue( options.GetOutputFolder() + options.GetOutputName() + ".ast"); + defaultOptions.length = sizeof(kClangDefaultOptions) / sizeof(MplOption); + + for (uint32_t i = 0; i < defaultOptions.length; ++i) { + defaultOptions.mplOptions[i].SetValue( + FileUtils::AppendMapleRootIfNeeded(defaultOptions.mplOptions[i].GetNeedRootPath(), + defaultOptions.mplOptions[i].GetValue(), + options.GetExeFolder())); + } + return defaultOptions; +} + +void ClangCompiler::GetTmpFilesToDelete(const MplOptions &mplOptions, std::vector &tempFiles) const { + tempFiles.push_back(mplOptions.GetOutputFolder() + mplOptions.GetOutputName() + ".ast"); +} + +std::unordered_set ClangCompiler::GetFinalOutputs(const MplOptions &mplOptions) const { + std::unordered_set finalOutputs; + (void)finalOutputs.insert(mplOptions.GetOutputFolder() + mplOptions.GetOutputName() + ".ast"); + return finalOutputs; +} + +} \ No newline at end of file diff --git a/src/mapleall/maple_driver/src/compiler_factory.cpp b/src/mapleall/maple_driver/src/compiler_factory.cpp index 5ca6e926a2dc6da525ec8397d5011aa79d24c040..8909e8897939d3f8b2a90a994792944cd8b74558 100644 --- a/src/mapleall/maple_driver/src/compiler_factory.cpp +++ b/src/mapleall/maple_driver/src/compiler_factory.cpp @@ -34,6 +34,8 @@ CompilerFactory::CompilerFactory() { // Supported compilers ADD_COMPILER("jbc2mpl", Jbc2MplCompiler) ADD_COMPILER("dex2mpl", Dex2MplCompiler) + ADD_COMPILER("mplfe", Cpp2MplCompiler) + ADD_COMPILER("clang", ClangCompiler) ADD_COMPILER("mplipa", IpaCompiler) ADD_COMPILER("me", MapleCombCompiler) ADD_COMPILER("mpl2mpl", MapleCombCompiler) diff --git a/src/mapleall/maple_driver/src/cpp2mpl_compiler.cpp b/src/mapleall/maple_driver/src/cpp2mpl_compiler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8ebae8b5f419b43e1a23e7d05cca30363d29385f --- /dev/null +++ b/src/mapleall/maple_driver/src/cpp2mpl_compiler.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. + * + * OpenArkCompiler is licensed under Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * + * http://license.coscl.org.cn/MulanPSL2 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR + * FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ +#include +#include "compiler.h" +#include "file_utils.h" +#include "mpl_logging.h" +#include "default_options.def" + +namespace maple { +std::string Cpp2MplCompiler::GetBinPath(const MplOptions&) const{ + return std::string(std::getenv(kMapleRoot)) + "/output/aarch64-clang-debug/bin/"; +} + +const std::string &Cpp2MplCompiler::GetBinName() const { + return kBinNameCpp2mpl; +} + +std::string Cpp2MplCompiler::GetInputFileName(const MplOptions &options) const { + if (!options.GetRunningExes().empty()) { + if (options.GetRunningExes()[0] == kBinNameCpp2mpl) { + return options.GetInputFiles(); + } + } + // Get base file name + auto idx = options.GetOutputName().find(".ast"); + std::string outputName = options.GetOutputName(); + if (idx != std::string::npos) { + outputName = options.GetOutputName().substr(0, idx); + } + return options.GetOutputFolder() + outputName + ".ast"; +} + +DefaultOption Cpp2MplCompiler::GetDefaultOptions(const MplOptions &options) const { + DefaultOption defaultOptions = { nullptr, 0 }; + defaultOptions.mplOptions = kCpp2MplDefaultOptionsForAst; + defaultOptions.length = sizeof(kCpp2MplDefaultOptionsForAst) / sizeof(MplOption); + + for (uint32_t i = 0; i < defaultOptions.length; ++i) { + defaultOptions.mplOptions[i].SetValue( + FileUtils::AppendMapleRootIfNeeded(defaultOptions.mplOptions[i].GetNeedRootPath(), + defaultOptions.mplOptions[i].GetValue(), + options.GetExeFolder())); + } + return defaultOptions; +} + +void Cpp2MplCompiler::GetTmpFilesToDelete(const MplOptions &mplOptions, std::vector &tempFiles) const { + tempFiles.push_back(mplOptions.GetOutputFolder() + mplOptions.GetOutputName() + ".mpl"); + tempFiles.push_back(mplOptions.GetOutputFolder() + mplOptions.GetOutputName() + ".mplt"); +} + +std::unordered_set Cpp2MplCompiler::GetFinalOutputs(const MplOptions &mplOptions) const { + std::unordered_set finalOutputs; + (void)finalOutputs.insert(mplOptions.GetOutputFolder() + mplOptions.GetOutputName() + ".mpl"); + (void)finalOutputs.insert(mplOptions.GetOutputFolder() + mplOptions.GetOutputName() + ".mplt"); + return finalOutputs; +} +} // namespace maple \ No newline at end of file diff --git a/src/mapleall/maple_driver/src/driver_option_common.cpp b/src/mapleall/maple_driver/src/driver_option_common.cpp index dda7b4487c0c467bad9d5ac2cbe91df48b15f711..f72c71c05183602a1d7cb115712442ce0268ba49 100644 --- a/src/mapleall/maple_driver/src/driver_option_common.cpp +++ b/src/mapleall/maple_driver/src/driver_option_common.cpp @@ -138,6 +138,23 @@ const mapleOption::Descriptor usages[] = { " --jbc2mpl-opt \tSet options for jbc2mpl\n", "all", {} }, + { kCpp2mplOpt, + 0, + "", + "mplfe-opt", + kBuildTypeProduct, + kArgCheckPolicyNone, + " --mplfe-opt \tSet options for mplfe\n", + "all", + {} }, + { kAsOpt, + 0, + "", + "as-opt", + kBuildTypeProduct, + kArgCheckPolicyNone, + "--as-opt \tSet options for as\n", + {} }, { kDex2mplOpt, 0, "", @@ -289,7 +306,7 @@ const mapleOption::Descriptor usages[] = { kArgCheckPolicyBool, " -verbose \t: print informations\n", "all", - { "jbc2mpl", "me", "mpl2mpl", "mplcg" } }, + { "jbc2mpl", "mplfe", "me", "mpl2mpl", "mplcg" } }, { kAllDebug, 0, "", diff --git a/src/mapleall/maple_driver/src/mpl_options.cpp b/src/mapleall/maple_driver/src/mpl_options.cpp index f16918ebb23731ce02efd9ef059dfe9975e1a1dd..001f7ea5ad96307a4cb30b7b70e740019f358326 100644 --- a/src/mapleall/maple_driver/src/mpl_options.cpp +++ b/src/mapleall/maple_driver/src/mpl_options.cpp @@ -31,6 +31,8 @@ #endif #include "ipa_option.h" #include "jbc2mpl_option.h" +#include "as_option.h" +#include "cpp2mpl_option.h" #include "me_option.h" #include "option.h" #include "cg_option.h" @@ -42,9 +44,9 @@ using namespace maplebe; const std::string kMapleDriverVersion = "MapleDriver " + std::to_string(Version::kMajorMplVersion) + "." + std::to_string(Version::kMinorCompilerVersion) + " 20190929"; -const std::vector kMapleCompilers = { "jbc2mpl", - "dex2mpl", "mplipa", - "me", "mpl2mpl", "mplcg" }; +const std::vector kMapleCompilers = { "jbc2mpl", "mplfe", + "dex2mpl", "mplipa", "as", + "me", "mpl2mpl", "mplcg", "clang"}; int MplOptions::Parse(int argc, char **argv) { optionParser.reset(new OptionParser()); @@ -56,6 +58,9 @@ int MplOptions::Parse(int argc, char **argv) { #endif optionParser->RegisteUsages(IpaOption::GetInstance()); optionParser->RegisteUsages(jbcUsage); + optionParser->RegisteUsages(cppUsage); + // Not sure if this is even required + // optionParser->RegisteUsages(asUsage); optionParser->RegisteUsages(Options::GetInstance()); optionParser->RegisteUsages(MeOption::GetInstance()); optionParser->RegisteUsages(CGOptions::GetInstance()); @@ -128,6 +133,18 @@ ErrorCode MplOptions::HandleGeneralOptions() { return ret; } break; + case kAsOpt: + ret = UpdatePhaseOption(opt.Args(), kBinNameAs); + if (ret != kErrorNoError) { + return ret; + } + break; + case kCpp2mplOpt: + ret = UpdatePhaseOption(opt.Args(), kBinNameCpp2mpl); + if (ret != kErrorNoError) { + return ret; + } + break; case kJbc2mplOpt: ret = UpdatePhaseOption(opt.Args(), kBinNameJbc2mpl); if (ret != kErrorNoError) { @@ -255,6 +272,14 @@ ErrorCode MplOptions::DecideRunningPhases() { bool isNeedMapleComb = true; bool isNeedMplcg = true; switch (inputFileType) { + case InputFileType::kFileTypeC: + case InputFileType::kFileTypeCpp: + UpdateRunningExe(kBinNameClang); + UpdateRunningExe(kBinNameCpp2mpl); + break; + case InputFileType::kFileTypeAst: + UpdateRunningExe(kBinNameCpp2mpl); + break; case InputFileType::kFileTypeJar: // fall-through case InputFileType::kFileTypeClass: @@ -359,9 +384,19 @@ bool MplOptions::Init(const std::string &inputFile) { else if (extensionName == "dex") { inputFileType = InputFileType::kFileTypeDex; } + else if (extensionName == "c") { + inputFileType = InputFileType::kFileTypeC; + } + else if (extensionName == "cpp") { + inputFileType = InputFileType::kFileTypeCpp; + } + else if (extensionName == "ast") { + inputFileType = InputFileType::kFileTypeAst; + } else if (extensionName == "jar") { inputFileType = InputFileType::kFileTypeJar; - } else if (extensionName == "mpl" || extensionName == "bpl") { + } + else if (extensionName == "mpl" || extensionName == "bpl") { if (firstInputFile.find("VtableImpl") == std::string::npos) { if (firstInputFile.find(".me.mpl") != std::string::npos) { inputFileType = InputFileType::kFileTypeMeMpl; @@ -605,4 +640,4 @@ void MplOptions::PrintDetailCommand(bool isBeforeParse) { << printCommandStr << " " << GetInputFileNameForPrint() << '\n'; } } -} // namespace maple +} // namespace maple