LLDB mainline
FortranLanguage.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/ADT/StringRef.h"
10
11#include "FortranLanguage.h"
12
14
15using namespace llvm;
16using namespace lldb;
17using namespace lldb_private;
18using namespace lldb_private::formatters;
19
21
26
30
32 static llvm::StringRef g_name("fortran");
33 return g_name;
34}
35
37
38uint32_t FortranLanguage::GetPluginVersion() { return 1; }
39
41 if (Language::LanguageIsFortran(language))
42 return new FortranLanguage();
43
44 return nullptr;
45}
46
47bool FortranLanguage::IsSourceFile(StringRef file_path) const {
48 const auto suffixes = {".f90", ".f", ".f95", ".f03", ".f08",
49 ".f18", ".for", ".ftn", ".fpp", ".f77"};
50 for (auto suffix : suffixes) {
51 if (file_path.ends_with_insensitive(suffix))
52 return true;
53 }
54 return false;
55}
#define LLDB_PLUGIN_DEFINE(PluginName)
llvm::StringRef GetPluginName() override
static lldb_private::Language * CreateInstance(lldb::LanguageType language)
static llvm::StringRef GetPluginNameStatic()
bool IsSourceFile(llvm::StringRef file_path) const override
static bool LanguageIsFortran(lldb::LanguageType language)
Definition Language.cpp:399
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
A class that represents a running process on the host machine.
LanguageType
Programming language type.