• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2/**
3 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// Autogenerated file -- DO NOT EDIT!
18
19#include <array>
20#include <memory>
21#include <unordered_map>
22#include "macros.h"
23#include "source_lang_enum.h"
24#include "verification/plugins.h"
25#include "verification/default_plugin.h"
26% Common::plugins.each do |plugin_lang, plugin_opts|
27%   next unless plugin_opts["Verification"]
28%   if plugin_opts["Verification"]["header"]
29#include "<%= plugin_opts["Verification"]["header"] %>"
30%   end
31% end
32
33// NOLINTBEGIN(fuchsia-statically-constructed-objects)
34namespace panda::verifier::plugin {
35
36% Common::plugins.each do |plugin_lang, plugin_opts|
37%   next unless plugin_opts["Verification"]
38%   if plugin_opts["Verification"]["header"]
39// NOLINTNEXTLINE(readability-identifier-naming)
40static <%= plugin_opts["Verification"]["plugin_class"] %> <%= plugin_lang %>_PLUGIN;
41%   end
42% end
43static DefaultPlugin g_dflt;
44
45static std::unordered_map<panda_file::SourceLang, Plugin const *> const PLUGINS_MAP {
46% Common::plugins.each do |plugin_lang, plugin_opts|
47%   short_plugin_lang = plugin_lang == "JAVA" ? "JAVA_8" : plugin_lang
48%   next unless plugin_opts["Verification"]
49%   if plugin_opts["Verification"]["plugin_class"]
50  { panda_file::SourceLang::<%= short_plugin_lang %>,
51    &<%= plugin_lang %>_PLUGIN },
52%   end
53% end
54  { panda_file::SourceLang::PANDA_ASSEMBLY, &g_dflt}
55};
56
57// NOLINTEND(fuchsia-statically-constructed-objects)
58Plugin const *GetLanguagePlugin(panda_file::SourceLang lang)
59{
60    if (PLUGINS_MAP.count(lang) > 0) {
61        return PLUGINS_MAP.at(lang);
62    }
63    return &g_dflt;
64}
65
66} // namespace panda::verifier::plugin
67