Skip to content

Commit 7133be1

Browse files
committed
remove diagnostic code and workarounds
Leftovers fixup
1 parent c53c94d commit 7133be1

File tree

20 files changed

+90
-148
lines changed

20 files changed

+90
-148
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6532,6 +6532,7 @@ std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
65326532
if (llvm::sys::fs::exists(Twine(P)))
65336533
return std::string(P);
65346534

6535+
// With Flang, also look for instrinsic modules
65356536
if (IsFlangMode()) {
65366537
if (std::optional<std::string> IntrPath =
65376538
TC.getDefaultIntrinsicModuleDir()) {

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,8 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
10491049

10501050
// Default intrinsic module dirs must be added after any user-provided
10511051
// -fintrinsic-modules-path to have lower precedence
1052-
if (auto IntrModPath = TC.getDefaultIntrinsicModuleDir()) {
1052+
if (std::optional<std::string> IntrModPath =
1053+
TC.getDefaultIntrinsicModuleDir()) {
10531054
CmdArgs.push_back("-fintrinsic-modules-path");
10541055
CmdArgs.push_back(Args.MakeArgString(*IntrModPath));
10551056
}

cmake/Modules/GetToolchainDirs.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ function (get_toolchain_library_subdir outvar)
4747
endfunction ()
4848

4949

50-
51-
52-
5350
# Corresponds to Flang's ToolChain::getDefaultIntrinsicModuleDir().
5451
function (get_toolchain_module_subdir outvar)
5552
set(outval "finclude/flang")

flang-rt/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ check_cxx_source_compiles(
159159
# NOTE: Does not work with Flang and CMake < 3.24
160160
cmake_push_check_state(RESET)
161161
set(CMAKE_REQUIRED_FLAGS "-ffree-form")
162-
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
162+
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
163163
check_fortran_source_compiles([[
164164
subroutine test_quadmath
165165
real(16) :: var1
@@ -265,4 +265,4 @@ if (FLANG_RT_INCLUDE_TESTS)
265265
add_subdirectory(unittests)
266266
else ()
267267
add_custom_target(check-flang-rt)
268-
endif()
268+
endif()

flang-rt/lib/runtime/CMakeLists.txt

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,20 @@ endif ()
242242

243243
if (NOT WIN32)
244244
# CMake ignores intrinsic USE dependencies
245-
# CMake has an option Fortran_BUILDING_INSTRINSIC_MODULES/Fortran_BUILDING_INTRINSIC_MODULES to disable this behavior, unfortunately it does not work with Ninja (https://gitlab.kitware.com/cmake/cmake/-/issues/26803)
246-
# As a workaround, we build those intrinsic modules first such that the main runtime can depend on it.
245+
# CMake has an option Fortran_BUILDING_INSTRINSIC_MODULES/Fortran_BUILDING_INTRINSIC_MODULES
246+
# to disable this behavior, unfortunately it does not work with Ninja
247+
# (https://gitlab.kitware.com/cmake/cmake/-/issues/26803)
248+
# As a workaround, we build those intrinsic modules first such that the main
249+
# runtime can depend on it.
247250
add_flangrt_library(flang_rt.intrinsics.obj OBJECT
248251
${intrinsics_sources}
249252
)
250253

251-
# This barrier exists to force all of the intrinsic modules of flang_rt.intrinsics.obj to be built before anything that depends on it.
252-
# Without it, CMake/Ninja seem to think that the modules of flang_rt.intrinsics.obj can be built concurrently to those in flang_rt.runtime.
254+
# This barrier exists to force all of the intrinsic modules of
255+
# flang_rt.intrinsics.obj to be built before anything that depends on it.
256+
# Without it, CMake/Ninja seem to think that the modules of
257+
# flang_rt.intrinsics.obj can be built concurrently to those in
258+
# flang_rt.runtime.
253259
add_custom_target(flang_rt.intrinsics
254260
COMMENT "Intrinsic module dependency barrier"
255261
)
@@ -308,9 +314,8 @@ else()
308314
endif ()
309315

310316
# Setting an unique Fortran_MODULE_DIRECTORY is required for each variant to
311-
# write a different .mod file.
312-
# One has to be selected to be the public module that is to be installed.
313-
# We select the first.
317+
# write a different .mod file. One of them has to be selected to be the
318+
# public module that is to be installed. We select the first.
314319
if (_has_public_intrinsics)
315320
set(is_public "")
316321
else ()

flang/CMakeLists.txt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -273,28 +273,6 @@ set(FLANG_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
273273
"Path for binary subdirectory (defaults to '${CMAKE_INSTALL_BINDIR}')")
274274
mark_as_advanced(FLANG_TOOLS_INSTALL_DIR)
275275

276-
#set(FLANG_INTRINSIC_MODULES_DIR "" CACHE PATH "Additional search path for modules; needed for running all tests if not building flang-rt in a bootstrapping build")
277-
#set(FLANG_TEST_FLANG_RT_Fortran_FLAGS "" CACHE STRING "Additional flags that makes Flang find the Flang-RT modules during testing; typically -fintrinsic-modules-path=<path>")
278-
#set(FLANG_TEST_OPENMP_Fortran_FLAGS "" CACHE STRING "Additional flags that makes Flang find the OpenMP modules during testing; typically -fintrinsic-modules-path=<path>")
279-
280-
set(FLANG_TEST_Fortran_FLAGS "" CACHE STRING "Additional Fortran flags for running tests, such as -fintrinsic-modules-path=<path>")
281-
282-
if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
283-
set(FLANG_TEST_ENABLE_INTRINSICS_default ON)
284-
else ()
285-
set(FLANG_TEST_ENABLE_INTRINSICS_default OFF)
286-
endif ()
287-
option(FLANG_TEST_ENABLE_INTRINSICS "Enable tests that require intrinsic modules from Flang-RT" "${FLANG_TEST_ENABLE_INTRINSICS_default}")
288-
289-
290-
if ("openmp" IN_LIST LLVM_ENABLE_RUNTIMES AND FLANG_TEST_ENABLE_INTRINSICS)
291-
set(FLANG_TEST_ENABLE_OPENMP_default ON)
292-
else ()
293-
set(FLANG_TEST_ENABLE_OPENMP_default OFF)
294-
endif ()
295-
option(FLANG_TEST_ENABLE_OPENMP "Enable tests that require modules from OpenMP" "${FLANG_TEST_ENABLE_OPENMP_default}")
296-
297-
298276
set(FLANG_INCLUDE_DIR ${FLANG_BINARY_DIR}/include)
299277

300278
# TODO: Remove when libclangDriver is lifted out of Clang

flang/lib/Semantics/mod-file.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,13 +1540,9 @@ Scope *ModFileReader::Read(SourceName name, std::optional<bool> isIntrinsic,
15401540
sourceFile->path());
15411541
return nullptr;
15421542
} else if (requiredHash && *requiredHash != *checkSum) {
1543-
std::string s;
1544-
llvm::raw_string_ostream OS(s);
1545-
OS << "'"s + name.ToString() + "': "s + sourceFile->path();
1546-
OS << " Expected: " << llvm::format_hex(*requiredHash, 8)
1547-
<< " Actual: " << llvm::format_hex(*checkSum, 8);
15481543
Say("use", name, ancestorName,
1549-
"File is not the right module file for %s"_err_en_US, OS.str());
1544+
"File is not the right module file for %s"_err_en_US,
1545+
"'"s + name.ToString() + "': "s + sourceFile->path());
15501546
return nullptr;
15511547
}
15521548
llvm::raw_null_ostream NullStream;

flang/test/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,31 @@
22
# for use by Lit, and delegates to LLVM's lit test handlers.
33
add_subdirectory(lib)
44

5+
set(FLANG_TEST_Fortran_FLAGS "" CACHE STRING "Additional Fortran flags for running tests, such as -fintrinsic-modules-path=<path>")
6+
7+
if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
8+
set(FLANG_TEST_ENABLE_INTRINSICS_default ON)
9+
else ()
10+
set(FLANG_TEST_ENABLE_INTRINSICS_default OFF)
11+
endif ()
12+
option(FLANG_TEST_ENABLE_INTRINSICS "Force-enable tests that require intrinsic modules from Flang-RT" "${FLANG_TEST_ENABLE_INTRINSICS_default}")
13+
14+
15+
if ("openmp" IN_LIST LLVM_ENABLE_RUNTIMES AND FLANG_TEST_ENABLE_INTRINSICS AND NOT FLANG_STANDALONE_BUILD)
16+
set(FLANG_TEST_ENABLE_OPENMP_default ON)
17+
else ()
18+
set(FLANG_TEST_ENABLE_OPENMP_default OFF)
19+
endif ()
20+
option(FLANG_TEST_ENABLE_OPENMP "Force-enable tests that require modules from OpenMP" "${FLANG_TEST_ENABLE_OPENMP_default}")
21+
22+
523
llvm_canonicalize_cmake_booleans(
624
FLANG_STANDALONE_BUILD
725
LLVM_BUILD_EXAMPLES
826
LLVM_BYE_LINK_INTO_TOOLS
927
LLVM_ENABLE_PLUGINS
28+
FLANG_TEST_ENABLE_INTRINSICS
29+
FLANG_TEST_ENABLE_OPENMP
1030
)
1131

1232
set(FLANG_TOOLS_DIR ${FLANG_BINARY_DIR}/bin)

flang/test/Driver/Inputs/ieee_arithmetic.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
! DUMMY module
22
! Added for testing purposes. The contents of this file are currently not relevant.
3-
! Using this file file cause an error because of missing checksum
3+
! Using this file will cause an error because of missing checksum
44
module ieee_arithmetic
55
type::ieee_round_type
66
integer(1),private::mode=0_1

flang/test/Driver/Inputs/iso_fortran_env.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
! DUMMY module
22
! Added for testing purposes. The contents of this file are currently not relevant.
3-
! Using this file file cause an error because of missing checksum
3+
! Using this file will cause an error because of missing checksum
44
module iso_fortran_env
55
use __fortran_builtins,only:event_type=>__builtin_event_type
66
use __fortran_builtins,only:lock_type=>__builtin_lock_type

0 commit comments

Comments
 (0)