[Lldb-commits] [lldb] [lldb][Fortran] Added DWARFASTParser for Fortran (PR #218024)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 7 02:29:56 PDT 2026


================
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file tests the Fortran plugin features.
+///
+//===----------------------------------------------------------------------===//
+
+#include "Plugins/Language/Fortran/FortranLanguage.h"
+#include "TestingSupport/SubsystemRAII.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+
+/// Returns the name of the LLDB plugin for the given language or an empty
+/// string if there is no fitting plugin.
+static llvm::StringRef GetPluginName(lldb::LanguageType language) {
+  if (Language *language_plugin = Language::FindPlugin(language))
+    return language_plugin->GetPluginName();
+  return "";
+}
+
+TEST(FortranLanguage, LookupFortranLanguageByLanguageType) {
+  SubsystemRAII<FortranLanguage> langs;
+
+  EXPECT_EQ(GetPluginName(lldb::eLanguageTypeFortran77), "fortran");
+  EXPECT_EQ(GetPluginName(lldb::eLanguageTypeFortran90), "fortran");
+  EXPECT_EQ(GetPluginName(lldb::eLanguageTypeFortran95), "fortran");
+  EXPECT_EQ(GetPluginName(lldb::eLanguageTypeFortran03), "fortran");
+  EXPECT_EQ(GetPluginName(lldb::eLanguageTypeFortran08), "fortran");
+  EXPECT_EQ(GetPluginName(lldb::eLanguageTypeFortran18), "fortran");
+}
----------------
DavidSpickett wrote:

Add newline at EOF

https://github.com/llvm/llvm-project/pull/218024


More information about the lldb-commits mailing list