[PATCH] D151722: Report EISDIR when opening a directory on AIX
Alison Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 30 08:40:21 PDT 2023
azhan92 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
azhan92 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151722
Files:
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/lib/Support/CommandLine.cpp
llvm/unittests/Support/CommandLineTest.cpp
Index: llvm/unittests/Support/CommandLineTest.cpp
===================================================================
--- llvm/unittests/Support/CommandLineTest.cpp
+++ llvm/unittests/Support/CommandLineTest.cpp
@@ -1060,7 +1060,6 @@
ASSERT_STREQ(Argv[0], "clang");
ASSERT_STREQ(Argv[1], AFileExp.c_str());
-#if !defined(_AIX) && !defined(__MVS__)
std::string ADirExp = std::string("@") + std::string(ADir.path());
Argv = {"clang", ADirExp.c_str()};
Res = cl::ExpandResponseFiles(Saver, cl::TokenizeGNUCommandLine, Argv);
@@ -1068,7 +1067,6 @@
ASSERT_EQ(2U, Argv.size());
ASSERT_STREQ(Argv[0], "clang");
ASSERT_STREQ(Argv[1], ADirExp.c_str());
-#endif
}
TEST(CommandLineTest, SetDefaultValue) {
Index: llvm/lib/Support/CommandLine.cpp
===================================================================
--- llvm/lib/Support/CommandLine.cpp
+++ llvm/lib/Support/CommandLine.cpp
@@ -1306,6 +1306,11 @@
}
const llvm::vfs::Status &FileStatus = Res.get();
+ if (FileStatus.isDirectory()) {
+ return createStringError(std::make_error_code(std::errc::is_a_directory),
+ Twine("cannot not open file '") + FName +
+ "': Is a directory");
+ }
auto IsEquivalent =
[FileStatus, this](const ResponseFileRecord &RFile) -> ErrorOr<bool> {
ErrorOr<llvm::vfs::Status> RHS = FS->status(RFile.File);
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -212,6 +212,8 @@
# -fPIC does not enable the large code model for GCC on AIX but does for XL.
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
append("-mcmodel=large" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
+ append("-Wl, bglink=large"
+ CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "XL")
# XL generates a small number of relocations not of the large model, -bbigtoc is needed.
append("-Wl,-bbigtoc"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151722.526645.patch
Type: text/x-patch
Size: 2124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230530/ac7d7b2d/attachment.bin>
More information about the llvm-commits
mailing list