[Lldb-commits] [lldb] [lldb][Fortran] Add Fortran language plugin to LLDB (PR #218014)
Iasonas Karaprodromidis via lldb-commits
lldb-commits at lists.llvm.org
Fri Sep 4 07:06:02 PDT 2026
https://github.com/Iasonaskrpr updated https://github.com/llvm/llvm-project/pull/218014
>From c94bc02707b56671dfe25e76eb4ca634cf6d2132 Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Mon, 6 Jul 2026 18:06:32 +0300
Subject: [PATCH 01/15] [lldb][Fortran] Added CMAKE variable guard for Fortran
support in LLDB
---
lldb/cmake/modules/FindFlang.cmake | 17 +++++++++++++++++
lldb/cmake/modules/LLDBConfig.cmake | 1 +
2 files changed, 18 insertions(+)
create mode 100644 lldb/cmake/modules/FindFlang.cmake
diff --git a/lldb/cmake/modules/FindFlang.cmake b/lldb/cmake/modules/FindFlang.cmake
new file mode 100644
index 0000000000000..f71d42c5fb586
--- /dev/null
+++ b/lldb/cmake/modules/FindFlang.cmake
@@ -0,0 +1,17 @@
+# FindFlang.cmake
+
+include(FindPackageHandleStandardArgs)
+
+# If Flang and lldb are in-tree then the libraries will already be available, otherwise look for specific directories
+if(TARGET flangFrontEnd)
+ set(Flang_FOUND TRUE)
+else()
+ find_package(Flang QUIET CONFIG HINTS ${Flang_DIR} ${LLVM_DIR}/../flang)
+endif()
+
+find_package_handle_standard_args(Flang
+ FOUND_VAR
+ Flang_FOUND
+ REQUIRED_VARS
+ Flang_FOUND
+)
\ No newline at end of file
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index e086aaf5d3632..82ad8b19ebb79 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -64,6 +64,7 @@ add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" L
add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" LibXml2 LIBXML2_FOUND VERSION ${LLDB_LIBXML2_VERSION})
add_optional_dependency(LLDB_ENABLE_TREESITTER "Enable Tree-sitter syntax highlighting" TreeSitter TREESITTER_FOUND)
+add_optional_dependency(LLDB_ENABLE_FORTRAN "Enable Fortran support in lldb" Flang Flang_FOUND)
option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON)
option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
>From 569e29d532ebf858728e4b79cfb93fd827f4dc16 Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Mon, 6 Jul 2026 22:14:20 +0300
Subject: [PATCH 02/15] [lldb] Removed support for out-of-tree flang builds
---
lldb/cmake/modules/FindFlang.cmake | 17 -----------------
lldb/cmake/modules/LLDBConfig.cmake | 9 ++++++++-
2 files changed, 8 insertions(+), 18 deletions(-)
delete mode 100644 lldb/cmake/modules/FindFlang.cmake
diff --git a/lldb/cmake/modules/FindFlang.cmake b/lldb/cmake/modules/FindFlang.cmake
deleted file mode 100644
index f71d42c5fb586..0000000000000
--- a/lldb/cmake/modules/FindFlang.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-# FindFlang.cmake
-
-include(FindPackageHandleStandardArgs)
-
-# If Flang and lldb are in-tree then the libraries will already be available, otherwise look for specific directories
-if(TARGET flangFrontEnd)
- set(Flang_FOUND TRUE)
-else()
- find_package(Flang QUIET CONFIG HINTS ${Flang_DIR} ${LLVM_DIR}/../flang)
-endif()
-
-find_package_handle_standard_args(Flang
- FOUND_VAR
- Flang_FOUND
- REQUIRED_VARS
- Flang_FOUND
-)
\ No newline at end of file
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 82ad8b19ebb79..ffb01342531dc 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -56,6 +56,14 @@ set(LLDB_LIBXML2_VERSION "2.8" CACHE STRING
static builds of libxml 2. Use at your own risk.")
mark_as_advanced(LLDB_LIBXML2_VERSION)
+set(LLDB_DEFAULT_ENABLE_FORTRAN OFF)
+
+if("flang" IN_LIST LLVM_ENABLE_PROJECTS)
+ set(LLDB_DEFAULT_ENABLE_FORTRAN ON)
+endif()
+
+option(LLDB_ENABLE_FORTRAN "Enable Fortran support in LLDB" ${LLDB_DEFAULT_ENABLE_FORTRAN})
+
add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB bindings" SWIG SWIG_FOUND VERSION 4)
add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
@@ -64,7 +72,6 @@ add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" L
add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" LibXml2 LIBXML2_FOUND VERSION ${LLDB_LIBXML2_VERSION})
add_optional_dependency(LLDB_ENABLE_TREESITTER "Enable Tree-sitter syntax highlighting" TreeSitter TREESITTER_FOUND)
-add_optional_dependency(LLDB_ENABLE_FORTRAN "Enable Fortran support in lldb" Flang Flang_FOUND)
option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON)
option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
>From 50fbbc56e37fca4514dd863b415c2a796cb5d32c Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Mon, 6 Jul 2026 22:39:47 +0300
Subject: [PATCH 03/15] Added error message
---
lldb/cmake/modules/LLDBConfig.cmake | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index ffb01342531dc..23809b5c94f84 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -64,6 +64,15 @@ endif()
option(LLDB_ENABLE_FORTRAN "Enable Fortran support in LLDB" ${LLDB_DEFAULT_ENABLE_FORTRAN})
+# Fail early if the user forced Fortran ON but we don't have in-tree Flang
+if(LLDB_ENABLE_FORTRAN AND NOT "flang" IN_LIST LLVM_ENABLE_PROJECTS)
+ message(FATAL_ERROR
+ "Fortran support in LLDB requires an in-tree Flang build. "
+ "Please add 'flang' to LLVM_ENABLE_PROJECTS or disable Fortran "
+ "support by passing -DLLDB_ENABLE_FORTRAN=OFF."
+ )
+endif()
+
add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB bindings" SWIG SWIG_FOUND VERSION 4)
add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
>From 9e620ae8a0e251001fdaf1fd4cfe82a318590d21 Mon Sep 17 00:00:00 2001
From: Iasonas Karaprodromidis <iaskarapro at gmail.com>
Date: Wed, 8 Jul 2026 15:53:34 +0300
Subject: [PATCH 04/15] Fix punctuation in comment
Co-authored-by: Jonas Devlieghere <jonas at devlieghere.com>
---
lldb/cmake/modules/LLDBConfig.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 23809b5c94f84..3f2e50cc7ab45 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -64,7 +64,7 @@ endif()
option(LLDB_ENABLE_FORTRAN "Enable Fortran support in LLDB" ${LLDB_DEFAULT_ENABLE_FORTRAN})
-# Fail early if the user forced Fortran ON but we don't have in-tree Flang
+# Fail early if the user forced Fortran ON but we don't have in-tree Flang.
if(LLDB_ENABLE_FORTRAN AND NOT "flang" IN_LIST LLVM_ENABLE_PROJECTS)
message(FATAL_ERROR
"Fortran support in LLDB requires an in-tree Flang build. "
>From 87d8be3cbb63f5ec4ede01ba7baa8e03d4067864 Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Fri, 17 Jul 2026 18:42:38 +0300
Subject: [PATCH 05/15] [lldb] Removed error if flang is not in enabled
projects but support was requested
---
lldb/cmake/modules/LLDBConfig.cmake | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 3f2e50cc7ab45..ffb01342531dc 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -64,15 +64,6 @@ endif()
option(LLDB_ENABLE_FORTRAN "Enable Fortran support in LLDB" ${LLDB_DEFAULT_ENABLE_FORTRAN})
-# Fail early if the user forced Fortran ON but we don't have in-tree Flang.
-if(LLDB_ENABLE_FORTRAN AND NOT "flang" IN_LIST LLVM_ENABLE_PROJECTS)
- message(FATAL_ERROR
- "Fortran support in LLDB requires an in-tree Flang build. "
- "Please add 'flang' to LLVM_ENABLE_PROJECTS or disable Fortran "
- "support by passing -DLLDB_ENABLE_FORTRAN=OFF."
- )
-endif()
-
add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB bindings" SWIG SWIG_FOUND VERSION 4)
add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
>From 2e1c0f845194c820f1483a5c1493c80a2c4d5914 Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Fri, 21 Aug 2026 21:38:19 +0300
Subject: [PATCH 06/15] [lldb] Added message printing if fortran is enabled
---
lldb/cmake/modules/LLDBConfig.cmake | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index ffb01342531dc..809ed2c7eed29 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -64,6 +64,12 @@ endif()
option(LLDB_ENABLE_FORTRAN "Enable Fortran support in LLDB" ${LLDB_DEFAULT_ENABLE_FORTRAN})
+if(LLDB_ENABLE_FORTRAN)
+ message(STATUS "Fortran support in LLDB enabled.")
+else()
+ message(STATUS "Fortran support in LLDB disabled.")
+endif()
+
add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB bindings" SWIG SWIG_FOUND VERSION 4)
add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
>From ace964d6d4bd9a14a94b034337d41a02a3169ea9 Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Mon, 6 Jul 2026 19:41:37 +0300
Subject: [PATCH 07/15] [lldb] Allow for Fortran API tests to use F_SOURCES in
Makefile
---
.../Python/lldbsuite/test/builders/builder.py | 10 ++++--
lldb/packages/Python/lldbsuite/test/dotest.py | 17 ++++++++++
.../Python/lldbsuite/test/dotest_args.py | 9 +++++
.../Python/lldbsuite/test/make/Makefile.rules | 33 ++++++++++++++++++-
lldb/test/API/CMakeLists.txt | 14 ++++++++
lldb/test/API/lit.cfg.py | 3 ++
lldb/test/API/lit.site.cfg.py.in | 2 ++
7 files changed, 85 insertions(+), 3 deletions(-)
diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py
index 93ce4cc732bd3..3aa4a7ea2c96a 100644
--- a/lldb/packages/Python/lldbsuite/test/builders/builder.py
+++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py
@@ -203,12 +203,18 @@ def getToolchainUtil(util_name):
if lldbplatformutil.platformIsDarwin():
utils.extend(["AR=%slibtool" % os.getenv("CROSS_COMPILE", "")])
- return [
+ build_cmd = [
"CC=%s" % cc,
"CC_TYPE=%s" % cc_type,
"CXX=%s" % cxx,
- ] + utils
+ ]
+
+ fc = configuration.fortran_compiler
+ if fc:
+ build_cmd.append("FC=%s" % fc)
+ return build_cmd + utils
+
def getSDKRootSpec(self):
"""
Helper function to return the key-value string to specify the SDK root
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index b1145f8f96078..c3bf11efccf03 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -267,6 +267,23 @@ def parseOptionsAndInitTestdirs():
configuration.compiler = candidate
break
+ if args.fortran_compiler:
+ configuration.fortran_compiler = os.path.abspath(args.fortran_compiler)
+ if not is_exe(configuration.fortran_compiler):
+ configuration.fortran_compiler = which(args.fortran_compiler)
+ if not is_exe(configuration.fortran_compiler):
+ logging.error(
+ '"%s" is not a valid Fortran compiler executable; aborting...', args.fortran_compiler
+ )
+ sys.exit(-1)
+ else:
+ # If no Fortran compiler was explicitly specified, search for local fallbacks.
+ candidateFortranCompilers = ["flang-new", "flang", "gfortran"]
+ for candidate in candidateFortranCompilers:
+ if which(candidate):
+ configuration.fortran_compiler = candidate
+ break
+
if args.make:
configuration.make_path = args.make
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index 13b3d85628dc2..c06ebd60ebcf0 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -48,6 +48,15 @@ def create_parser():
"""Specify the compiler(s) used to build the inferior executables. The compiler path can be an executable basename or a full path to a compiler executable. This option can be specified multiple times."""
),
)
+ group.add_argument(
+ '--fortran-compiler',
+ metavar="fortran_compiler",
+ dest='fortran_compiler',
+ default="",
+ help=textwrap.dedent(
+ """The fortran compiler used to build the test programs."""
+ ),
+ )
group.add_argument(
"--sysroot",
metavar="sysroot",
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 51729959fdf62..86e92f6ac6427 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -255,14 +255,17 @@ endif
DEBUG_INFO_FLAG ?= -g
CFLAGS ?= $(DEBUG_INFO_FLAG) -O0
+FFLAGS ?= $(DEBUG_INFO_FLAG) -O0
# Some tests require no debug information. When lldb-dotest specifies a DWARF version,
# it adds `-gdwarf-{version}` to the CFLAGS environment variable which causes those tests
# to fail. Strip any existing debug flags from CFLAGS and force -g0 to prevent this.
ifeq "$(MAKE_NO_DEBUG_INFO)" "YES"
CFLAGS := $(filter-out -g%,$(CFLAGS)) -g0
+ FFLAGS := $(filter-out -g%,$(FFLAGS)) -g0
endif
CFLAGS += $(SYSROOT_FLAGS)
+FFLAGS += $(SYSROOT_FLAGS)
ifeq "$(OS)" "Darwin"
CFLAGS += $(FRAMEWORK_INCLUDES)
@@ -270,18 +273,22 @@ endif
CFLAGS += -I$(LLDB_BASE_DIR)/include -I$(LLDB_OBJ_ROOT)/include
CFLAGS += -I$(SRCDIR) -I$(THIS_FILE_DIR)
+FFLAGS += -I$(LLDB_BASE_DIR)/include -I$(LLDB_OBJ_ROOT)/include
+FFLAGS += -I$(SRCDIR) -I$(THIS_FILE_DIR)
ifndef NO_TEST_COMMON_H
CFLAGS += -include $(THIS_FILE_DIR)/test_common.h
endif
CFLAGS += $(NO_LIMIT_DEBUG_INFO_FLAGS) $(ARCH_CFLAGS)
+FFLAGS += $(ARCH_CFLAGS)
# Use this one if you want to build one part of the result without debug information:
CFLAGS_NO_DEBUG = -O0 $(FRAMEWORK_INCLUDES) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS) $(SYSROOT_FLAGS)
ifeq "$(MAKE_DWO)" "YES"
CFLAGS += -gsplit-dwarf
+ FFLAGS += -gsplit-dwarf
endif
ifeq "$(MAKE_DEBUG_NAMES)" "YES"
@@ -324,10 +331,17 @@ ifeq ($(CC_TYPE), clang)
endif
CFLAGS += $(CFLAGS_EXTRAS)
+FFLAGS += $(FFLAGS_EXTRAS)
CXXFLAGS += -std=c++11 $(CFLAGS) $(ARCH_CXXFLAGS)
# Copy common options to the linker flags (dwarf, arch. & etc).
# Note: we get some 'garbage' options for linker here (such as -I, --isystem & etc).
-LDFLAGS += $(CFLAGS)
+ifneq "$(strip $(F_SOURCES))" ""
+ # We are building Fortran. Use FFLAGS flags.
+ LDFLAGS += $(FFLAGS)
+else
+ # We are building C/C++. Use CFLAGS.
+ LDFLAGS += $(CFLAGS)
+endif
LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS)
ifeq (,$(filter $(OS), Windows_NT Android Darwin Wasm))
ifneq (,$(filter YES,$(ENABLE_THREADS)))
@@ -540,6 +554,20 @@ ifeq ($(CC_TYPE), clang)
CXXFLAGS += --driver-mode=g++
endif
+#----------------------------------------------------------------------
+# Check if we have any Fortran source files
+#----------------------------------------------------------------------
+ifneq "$(strip $(F_SOURCES))" ""
+ ifeq "$(FC)" ""
+ $(error "No Fortran compiler found for fortran tests")
+ endif
+ OBJECTS +=$(strip $(F_SOURCES:.f90=.o))
+ # Override the linker with the Fortran compiler, LDC is not needed
+ # currently so it is set to any
+ override LD := $(FC)
+ override LDC := any
+endif
+
ifneq "$(CXX)" ""
# Specify the driver mode parameter if we use clang as the linker.
ifeq ($(LDC), clang)
@@ -673,6 +701,9 @@ endif
%.o: %.mm %.d
$(CXX) $(CXXFLAGS) -MT $@ -MD -MP -MF $*.d -c -o $@ $<
+%.o: %.f90
+ $(FC) $(FFLAGS) -c -o $@ $<
+
#----------------------------------------------------------------------
# Automatic variables based on items already entered. Below we create
# an object's lists from the list of sources by replacing all entries
diff --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index bff3bac438d6b..ad093dd6e3ccb 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -88,6 +88,20 @@ else()
set(LLDB_DEFAULT_TEST_COMPILER "")
endif()
+if(LLDB_ENABLE_FORTRAN)
+ # Prefer the in-tree built target if available.
+ if(TARGET flang)
+ set(LLDB_DEFAULT_TEST_FORTRAN_COMPILER "${LLVM_TOOLS_BINARY_DIR}/flang${CMAKE_EXECUTABLE_SUFFIX}")
+ # Fall back to the out-of-tree installation prefix if configured via find_package.
+ elif(FLANG_INSTALL_PREFIX)
+ set(LLDB_DEFAULT_TEST_FORTRAN_COMPILER "${FLANG_INSTALL_PREFIX}/bin/flang${CMAKE_EXECUTABLE_SUFFIX}")
+ else()
+ set(LLDB_DEFAULT_TEST_FORTRAN_COMPILER "")
+ endif()
+
+ set(LLDB_TEST_FORTRAN_COMPILER "${LLDB_DEFAULT_TEST_FORTRAN_COMPILER}" CACHE PATH "Fortran Compiler to use for building LLDB test inferiors")
+endif()
+
set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb executable used for testing")
set(LLDB_TEST_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors")
set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil used for generating dSYM bundles")
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 7d6b43f07287d..3d27aa6f7d3bc 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -297,6 +297,9 @@ def delete_module_cache(path):
if is_configured("test_compiler"):
dotest_cmd += ["--compiler", config.test_compiler]
+if is_configured("fortran_test_compiler"):
+ dotest_cmd += ["--fortran-compiler", config.fortran_test_compiler]
+
if is_configured("dsymutil"):
dotest_cmd += ["--dsymutil", config.dsymutil]
diff --git a/lldb/test/API/lit.site.cfg.py.in b/lldb/test/API/lit.site.cfg.py.in
index 44c62414f8bdd..c655f9b1dfd96 100644
--- a/lldb/test/API/lit.site.cfg.py.in
+++ b/lldb/test/API/lit.site.cfg.py.in
@@ -24,6 +24,7 @@ config.python_root_dir = "@Python3_ROOT_DIR@"
config.lua_executable = "@LUA_EXECUTABLE@"
config.lldb_lua_cpath = "@LLDB_LUA_CPATH@"
config.lua_test_entry = "TestLuaAPI.py"
+config.lldb_enable_fortran = "@LLDB_ENABLE_FORTRAN@"
config.dotest_common_args_str = lit_config.substitute("@LLDB_TEST_COMMON_ARGS@")
config.dotest_user_args_str = lit_config.substitute("@LLDB_TEST_USER_ARGS@")
config.lldb_platform_url = lit_config.substitute("@LLDB_TEST_PLATFORM_URL@")
@@ -36,6 +37,7 @@ config.enabled_plugins = []
config.lldb_executable = lit_config.substitute('@LLDB_TEST_EXECUTABLE@')
config.test_triple = '@LLDB_TEST_TRIPLE@'
config.test_compiler = lit_config.substitute('@LLDB_TEST_COMPILER@')
+config.fortran_test_compiler = lit_config.substitute('@LLDB_TEST_FORTRAN_COMPILER@')
config.dsymutil = lit_config.substitute('@LLDB_TEST_DSYMUTIL@')
config.make = lit_config.substitute('@LLDB_TEST_MAKE@')
config.has_libcxx = @LLDB_HAS_LIBCXX@
>From 1d3053c2a7781573f38a9315cc17fe70ea3aebd3 Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Mon, 6 Jul 2026 20:20:47 +0300
Subject: [PATCH 08/15] [lldb] Removed broken elseif statement in CMake
---
lldb/test/API/CMakeLists.txt | 3 ---
1 file changed, 3 deletions(-)
diff --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index ad093dd6e3ccb..540a1280ad04a 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -92,9 +92,6 @@ if(LLDB_ENABLE_FORTRAN)
# Prefer the in-tree built target if available.
if(TARGET flang)
set(LLDB_DEFAULT_TEST_FORTRAN_COMPILER "${LLVM_TOOLS_BINARY_DIR}/flang${CMAKE_EXECUTABLE_SUFFIX}")
- # Fall back to the out-of-tree installation prefix if configured via find_package.
- elif(FLANG_INSTALL_PREFIX)
- set(LLDB_DEFAULT_TEST_FORTRAN_COMPILER "${FLANG_INSTALL_PREFIX}/bin/flang${CMAKE_EXECUTABLE_SUFFIX}")
else()
set(LLDB_DEFAULT_TEST_FORTRAN_COMPILER "")
endif()
>From 416ae1fbac31bcb781feb5a6b46a8ed348534429 Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Wed, 8 Jul 2026 22:34:02 +0300
Subject: [PATCH 09/15] [lldb] Fixed formatting
---
lldb/packages/Python/lldbsuite/test/builders/builder.py | 4 ++--
lldb/packages/Python/lldbsuite/test/dotest.py | 3 ++-
lldb/packages/Python/lldbsuite/test/dotest_args.py | 6 +++---
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py
index 3aa4a7ea2c96a..c53de950028e8 100644
--- a/lldb/packages/Python/lldbsuite/test/builders/builder.py
+++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py
@@ -211,10 +211,10 @@ def getToolchainUtil(util_name):
fc = configuration.fortran_compiler
if fc:
- build_cmd.append("FC=%s" % fc)
+ build_cmd.append("FC=%s" % fc)
return build_cmd + utils
-
+
def getSDKRootSpec(self):
"""
Helper function to return the key-value string to specify the SDK root
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index c3bf11efccf03..9c415ec5889b3 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -273,7 +273,8 @@ def parseOptionsAndInitTestdirs():
configuration.fortran_compiler = which(args.fortran_compiler)
if not is_exe(configuration.fortran_compiler):
logging.error(
- '"%s" is not a valid Fortran compiler executable; aborting...', args.fortran_compiler
+ '"%s" is not a valid Fortran compiler executable; aborting...',
+ args.fortran_compiler,
)
sys.exit(-1)
else:
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index c06ebd60ebcf0..49bd9fefc40c2 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -49,14 +49,14 @@ def create_parser():
),
)
group.add_argument(
- '--fortran-compiler',
+ "--fortran-compiler",
metavar="fortran_compiler",
- dest='fortran_compiler',
+ dest="fortran_compiler",
default="",
help=textwrap.dedent(
"""The fortran compiler used to build the test programs."""
),
- )
+ )
group.add_argument(
"--sysroot",
metavar="sysroot",
>From db7e9806d1da9bcbddc5d92c4007d3a81ea7e244 Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Wed, 8 Jul 2026 23:12:13 +0300
Subject: [PATCH 10/15] [lldb] Added fortran_compiler to configuration
---
lldb/packages/Python/lldbsuite/test/configuration.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py
index 7f9616be9a482..db2cec5e405b9 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/lldb/packages/Python/lldbsuite/test/configuration.py
@@ -43,6 +43,7 @@
# command line.
arch = None
compiler = None
+fortran_compiler = None
dsymutil = None
sdkroot = None
make_path = None
>From c390be0bb969a7144ba1c44a24bc2326942a25ff Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Fri, 10 Jul 2026 22:33:34 +0300
Subject: [PATCH 11/15] [lldb] Addressed code quality comments
---
lldb/packages/Python/lldbsuite/test/dotest_args.py | 2 +-
lldb/packages/Python/lldbsuite/test/make/Makefile.rules | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index 49bd9fefc40c2..8791ddc377c65 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -54,7 +54,7 @@ def create_parser():
dest="fortran_compiler",
default="",
help=textwrap.dedent(
- """The fortran compiler used to build the test programs."""
+ """The Fortran compiler used to build the test programs."""
),
)
group.add_argument(
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 86e92f6ac6427..22eeeb24a59c1 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -261,8 +261,8 @@ FFLAGS ?= $(DEBUG_INFO_FLAG) -O0
# it adds `-gdwarf-{version}` to the CFLAGS environment variable which causes those tests
# to fail. Strip any existing debug flags from CFLAGS and force -g0 to prevent this.
ifeq "$(MAKE_NO_DEBUG_INFO)" "YES"
- CFLAGS := $(filter-out -g%,$(CFLAGS)) -g0
- FFLAGS := $(filter-out -g%,$(FFLAGS)) -g0
+ CFLAGS := $(filter-out -g%,$(CFLAGS)) -g0
+ FFLAGS := $(filter-out -g%,$(FFLAGS)) -g0
endif
CFLAGS += $(SYSROOT_FLAGS)
FFLAGS += $(SYSROOT_FLAGS)
@@ -558,12 +558,12 @@ endif
# Check if we have any Fortran source files
#----------------------------------------------------------------------
ifneq "$(strip $(F_SOURCES))" ""
- ifeq "$(FC)" ""
+ ifeq "$(FC)" ""
$(error "No Fortran compiler found for fortran tests")
endif
OBJECTS +=$(strip $(F_SOURCES:.f90=.o))
# Override the linker with the Fortran compiler, LDC is not needed
- # currently so it is set to any
+ # currently so it is set to any.
override LD := $(FC)
override LDC := any
endif
>From cc2b09e625323229fd5d3cfc190925455bdf61a4 Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Fri, 21 Aug 2026 22:19:03 +0300
Subject: [PATCH 12/15] [lldb] Added LanguageIsFortran helper to language class
---
lldb/include/lldb/Target/Language.h | 2 ++
lldb/source/Target/Language.cpp | 14 ++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h
index bd3faf89658c9..5c7bdfcc628ce 100644
--- a/lldb/include/lldb/Target/Language.h
+++ b/lldb/include/lldb/Target/Language.h
@@ -443,6 +443,8 @@ class Language : public PluginInterface {
/// Equivalent to \c LanguageIsC||LanguageIsObjC||LanguageIsCPlusPlus.
static bool LanguageIsCFamily(lldb::LanguageType language);
+ static bool LanguageIsFortran(lldb::LanguageType language);
+
static bool LanguageIsPascal(lldb::LanguageType language);
// return the primary language, so if LanguageIsC(l), return eLanguageTypeC,
diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp
index 077c403f4ea58..a4d6031b4b27d 100644
--- a/lldb/source/Target/Language.cpp
+++ b/lldb/source/Target/Language.cpp
@@ -396,6 +396,20 @@ bool Language::LanguageIsCFamily(LanguageType language) {
}
}
+bool Language::LanguageIsFortran(LanguageType language) {
+ switch (language) {
+ case eLanguageTypeFortran77:
+ case eLanguageTypeFortran90:
+ case eLanguageTypeFortran95:
+ case eLanguageTypeFortran03:
+ case eLanguageTypeFortran08:
+ case eLanguageTypeFortran18:
+ return true;
+ default:
+ return false;
+ }
+}
+
bool Language::LanguageIsPascal(LanguageType language) {
switch (language) {
case eLanguageTypePascal83:
>From 9ae401cb1e563069eef0b4094a5d9c2a31817bfa Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Fri, 21 Aug 2026 22:19:33 +0300
Subject: [PATCH 13/15] [lldb][Fortran] Added Fortran language PLugin
---
lldb/source/Plugins/Language/CMakeLists.txt | 3 +
.../Plugins/Language/Fortran/CMakeLists.txt | 12 ++++
.../Language/Fortran/FortranLanguage.cpp | 62 +++++++++++++++++++
.../Language/Fortran/FortranLanguage.h | 58 +++++++++++++++++
4 files changed, 135 insertions(+)
create mode 100644 lldb/source/Plugins/Language/Fortran/CMakeLists.txt
create mode 100644 lldb/source/Plugins/Language/Fortran/FortranLanguage.cpp
create mode 100644 lldb/source/Plugins/Language/Fortran/FortranLanguage.h
diff --git a/lldb/source/Plugins/Language/CMakeLists.txt b/lldb/source/Plugins/Language/CMakeLists.txt
index 6367ab916c8fb..2dd89b5207a57 100644
--- a/lldb/source/Plugins/Language/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CMakeLists.txt
@@ -7,3 +7,6 @@ set_property(DIRECTORY PROPERTY LLDB_TOLERATED_PLUGIN_DEPENDENCIES
add_subdirectory(CPlusPlus)
add_subdirectory(ObjC)
add_subdirectory(ObjCPlusPlus)
+if(LLDB_ENABLE_FORTRAN)
+ add_subdirectory(Fortran)
+endif()
\ No newline at end of file
diff --git a/lldb/source/Plugins/Language/Fortran/CMakeLists.txt b/lldb/source/Plugins/Language/Fortran/CMakeLists.txt
new file mode 100644
index 0000000000000..7c5faa87aeaba
--- /dev/null
+++ b/lldb/source/Plugins/Language/Fortran/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_lldb_library(lldbPluginFortranLanguage PLUGIN
+ FortranLanguage.cpp
+
+ LINK_LIBS
+ lldbCore
+ lldbDataFormatters
+ lldbExpression
+ lldbHost
+ lldbSymbol
+ lldbTarget
+ lldbUtility
+)
\ No newline at end of file
diff --git a/lldb/source/Plugins/Language/Fortran/FortranLanguage.cpp b/lldb/source/Plugins/Language/Fortran/FortranLanguage.cpp
new file mode 100644
index 0000000000000..073c963d4492d
--- /dev/null
+++ b/lldb/source/Plugins/Language/Fortran/FortranLanguage.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 implements the Fortran language Plugin.
+///
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/StringRef.h"
+
+#include "FortranLanguage.h"
+
+#include "lldb/Core/PluginManager.h"
+
+using namespace llvm;
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+LLDB_PLUGIN_DEFINE(FortranLanguage)
+
+void FortranLanguage::Initialize() {
+ PluginManager::RegisterPlugin(GetPluginNameStatic(), "Fortran Language",
+ CreateInstance);
+}
+
+void FortranLanguage::Terminate() {
+ PluginManager::UnregisterPlugin(CreateInstance);
+}
+
+StringRef FortranLanguage::GetPluginNameStatic() {
+ static llvm::StringRef g_name("fortran");
+ return g_name;
+}
+
+//------------------------------------------------------------------
+// PluginInterface protocol
+//------------------------------------------------------------------
+StringRef FortranLanguage::GetPluginName() { return GetPluginNameStatic(); }
+
+uint32_t FortranLanguage::GetPluginVersion() { return 1; }
+
+Language *FortranLanguage::CreateInstance(LanguageType language) {
+ if (Language::LanguageIsFortran(language)) {
+ return new FortranLanguage();
+ }
+ return nullptr;
+}
+
+bool FortranLanguage::IsSourceFile(StringRef file_path) const {
+ const auto suffixes = {".f90", ".f", ".f95", ".f03", ".f08", ".f18"};
+ for (auto suffix : suffixes) {
+ if (file_path.ends_with_insensitive(suffix))
+ return true;
+ }
+ return false;
+}
\ No newline at end of file
diff --git a/lldb/source/Plugins/Language/Fortran/FortranLanguage.h b/lldb/source/Plugins/Language/Fortran/FortranLanguage.h
new file mode 100644
index 0000000000000..2bd616f347b78
--- /dev/null
+++ b/lldb/source/Plugins/Language/Fortran/FortranLanguage.h
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 defines the Fortran language Plugin.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_FORTRAN_FORTRANLANGUAGE_H
+#define LLDB_SOURCE_PLUGINS_LANGUAGE_FORTRAN_FORTRANLANGUAGE_H
+#include "lldb/Target/Language.h"
+
+#include "llvm/ADT/StringRef.h"
+
+#include "lldb/Target/Language.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class FortranLanguage : public Language {
+public:
+ FortranLanguage() = default;
+
+ ~FortranLanguage() override = default;
+
+ lldb::LanguageType GetLanguageType() const override {
+ return lldb::eLanguageTypeFortran90;
+ }
+ //------------------------------------------------------------------
+ // Static Functions
+ //------------------------------------------------------------------
+ static void Initialize();
+
+ static void Terminate();
+
+ static lldb_private::Language *CreateInstance(lldb::LanguageType language);
+
+ static llvm::StringRef GetPluginNameStatic();
+
+ //------------------------------------------------------------------
+ // PluginInterface protocol
+ //------------------------------------------------------------------
+ llvm::StringRef GetPluginName() override;
+
+ uint32_t GetPluginVersion();
+
+ bool IsSourceFile(llvm::StringRef file_path) const override;
+};
+
+}; // namespace lldb_private
+
+#endif // LLDB_SOURCE_PLUGINS_LANGUAGE_FORTRAN_FORTRANLANGUAGE_H
\ No newline at end of file
>From 1f67c2943dff7ba7f29f1237bdc7526e5b4d62dd Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Fri, 21 Aug 2026 22:20:03 +0300
Subject: [PATCH 14/15] [lldb][Fortran] Added Fortran language plugin tests
---
lldb/unittests/Language/CMakeLists.txt | 3 ++
.../unittests/Language/Fortran/CMakeLists.txt | 6 +++
.../Language/Fortran/FortranLanguageTest.cpp | 41 +++++++++++++++++++
3 files changed, 50 insertions(+)
create mode 100644 lldb/unittests/Language/Fortran/CMakeLists.txt
create mode 100644 lldb/unittests/Language/Fortran/FortranLanguageTest.cpp
diff --git a/lldb/unittests/Language/CMakeLists.txt b/lldb/unittests/Language/CMakeLists.txt
index a0bdc62af98c6..db43874757bc3 100644
--- a/lldb/unittests/Language/CMakeLists.txt
+++ b/lldb/unittests/Language/CMakeLists.txt
@@ -1,3 +1,6 @@
add_subdirectory(CPlusPlus)
add_subdirectory(CLanguages)
add_subdirectory(ObjC)
+if(LLDB_ENABLE_FORTRAN)
+ add_subdirectory(Fortran)
+endif()
\ No newline at end of file
diff --git a/lldb/unittests/Language/Fortran/CMakeLists.txt b/lldb/unittests/Language/Fortran/CMakeLists.txt
new file mode 100644
index 0000000000000..661b12ebf8950
--- /dev/null
+++ b/lldb/unittests/Language/Fortran/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_lldb_unittest(LanguageFortranLanguageTests
+ FortranLanguageTest.cpp
+
+ LINK_LIBS
+ lldbPluginFortranLanguage
+)
diff --git a/lldb/unittests/Language/Fortran/FortranLanguageTest.cpp b/lldb/unittests/Language/Fortran/FortranLanguageTest.cpp
new file mode 100644
index 0000000000000..5b81544539785
--- /dev/null
+++ b/lldb/unittests/Language/Fortran/FortranLanguageTest.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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) {
+ Language *language_plugin = Language::FindPlugin(language);
+ if (language_plugin)
+ 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");
+}
>From 764a9b47f5f315e76596012bed2629ef1d0f39ae Mon Sep 17 00:00:00 2001
From: Iasonaskrpr <iaskarapro at gmail.com>
Date: Fri, 4 Sep 2026 17:05:39 +0300
Subject: [PATCH 15/15] [lldb][Fortran] Made suggested review changes
---
lldb/source/Plugins/Language/Fortran/CMakeLists.txt | 2 +-
lldb/source/Plugins/Language/Fortran/FortranLanguage.cpp | 7 ++++---
lldb/source/Plugins/Language/Fortran/FortranLanguage.h | 9 +++------
lldb/unittests/Language/Fortran/FortranLanguageTest.cpp | 2 +-
4 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/lldb/source/Plugins/Language/Fortran/CMakeLists.txt b/lldb/source/Plugins/Language/Fortran/CMakeLists.txt
index 7c5faa87aeaba..3ee934fa01f52 100644
--- a/lldb/source/Plugins/Language/Fortran/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/Fortran/CMakeLists.txt
@@ -9,4 +9,4 @@ add_lldb_library(lldbPluginFortranLanguage PLUGIN
lldbSymbol
lldbTarget
lldbUtility
-)
\ No newline at end of file
+)
diff --git a/lldb/source/Plugins/Language/Fortran/FortranLanguage.cpp b/lldb/source/Plugins/Language/Fortran/FortranLanguage.cpp
index 073c963d4492d..5df2f36f92eb7 100644
--- a/lldb/source/Plugins/Language/Fortran/FortranLanguage.cpp
+++ b/lldb/source/Plugins/Language/Fortran/FortranLanguage.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// This file implements the Fortran language Plugin.
+/// This file implements the Fortran language plugin.
///
//===----------------------------------------------------------------------===//
@@ -53,10 +53,11 @@ Language *FortranLanguage::CreateInstance(LanguageType language) {
}
bool FortranLanguage::IsSourceFile(StringRef file_path) const {
- const auto suffixes = {".f90", ".f", ".f95", ".f03", ".f08", ".f18"};
+ const auto suffixes = {".f90", ".f", ".f95", ".f03", ".f08",
+ ".f18", ".for", ".ftn", ".fpp", ",f77"};
for (auto suffix : suffixes) {
if (file_path.ends_with_insensitive(suffix))
return true;
}
return false;
-}
\ No newline at end of file
+}
diff --git a/lldb/source/Plugins/Language/Fortran/FortranLanguage.h b/lldb/source/Plugins/Language/Fortran/FortranLanguage.h
index 2bd616f347b78..6d6a2d264089a 100644
--- a/lldb/source/Plugins/Language/Fortran/FortranLanguage.h
+++ b/lldb/source/Plugins/Language/Fortran/FortranLanguage.h
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// This file defines the Fortran language Plugin.
+/// This file defines the Fortran language plugin.
///
//===----------------------------------------------------------------------===//
@@ -32,9 +32,8 @@ class FortranLanguage : public Language {
lldb::LanguageType GetLanguageType() const override {
return lldb::eLanguageTypeFortran90;
}
- //------------------------------------------------------------------
+
// Static Functions
- //------------------------------------------------------------------
static void Initialize();
static void Terminate();
@@ -43,9 +42,7 @@ class FortranLanguage : public Language {
static llvm::StringRef GetPluginNameStatic();
- //------------------------------------------------------------------
// PluginInterface protocol
- //------------------------------------------------------------------
llvm::StringRef GetPluginName() override;
uint32_t GetPluginVersion();
@@ -55,4 +52,4 @@ class FortranLanguage : public Language {
}; // namespace lldb_private
-#endif // LLDB_SOURCE_PLUGINS_LANGUAGE_FORTRAN_FORTRANLANGUAGE_H
\ No newline at end of file
+#endif // LLDB_SOURCE_PLUGINS_LANGUAGE_FORTRAN_FORTRANLANGUAGE_H
diff --git a/lldb/unittests/Language/Fortran/FortranLanguageTest.cpp b/lldb/unittests/Language/Fortran/FortranLanguageTest.cpp
index 5b81544539785..7c5eb24bcf8d7 100644
--- a/lldb/unittests/Language/Fortran/FortranLanguageTest.cpp
+++ b/lldb/unittests/Language/Fortran/FortranLanguageTest.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// This file tests the Fortran Plugin features.
+/// This file tests the Fortran plugin features.
///
//===----------------------------------------------------------------------===//
More information about the lldb-commits
mailing list