-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[clang] Rename files that MacOS libtool warns about (NFC) #150054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-clang Author: Jonathan Thackray (jthackray) ChangesAs mentioned in https://discourse.llvm.org/t/rfc-rename-source-files-in-clang-lib-codegen-targetbuiltins/87462/ it appears that MacOS's libtool warns about source filenames that are identically named, even if they exist in separate directories. Sadly, there doesn't appear to be an easy way to disable this warning, so rename these files, as these warnings are annoying for MacOS users. Fixes #133199. Full diff: https://github.com/llvm/llvm-project/pull/150054.diff 12 Files Affected:
diff --git a/clang/lib/CodeGen/CMakeLists.txt b/clang/lib/CodeGen/CMakeLists.txt
index 0f2a352886e7f..38bba115117da 100644
--- a/clang/lib/CodeGen/CMakeLists.txt
+++ b/clang/lib/CodeGen/CMakeLists.txt
@@ -117,17 +117,17 @@ add_clang_library(clangCodeGen
PatternInit.cpp
SanitizerMetadata.cpp
SwiftCallingConv.cpp
- TargetBuiltins/ARM.cpp
- TargetBuiltins/AMDGPU.cpp
- TargetBuiltins/DirectX.cpp
- TargetBuiltins/Hexagon.cpp
- TargetBuiltins/NVPTX.cpp
- TargetBuiltins/PPC.cpp
- TargetBuiltins/RISCV.cpp
- TargetBuiltins/SPIR.cpp
- TargetBuiltins/SystemZ.cpp
- TargetBuiltins/WebAssembly.cpp
- TargetBuiltins/X86.cpp
+ TargetBuiltins/BuiltinARM.cpp
+ TargetBuiltins/BuiltinAMDGPU.cpp
+ TargetBuiltins/BuiltinDirectX.cpp
+ TargetBuiltins/BuiltinHexagon.cpp
+ TargetBuiltins/BuiltinNVPTX.cpp
+ TargetBuiltins/BuiltinPPC.cpp
+ TargetBuiltins/BuiltinRISCV.cpp
+ TargetBuiltins/BuiltinSPIR.cpp
+ TargetBuiltins/BuiltinSystemZ.cpp
+ TargetBuiltins/BuiltinWebAssembly.cpp
+ TargetBuiltins/BuiltinX86.cpp
TargetInfo.cpp
Targets/AArch64.cpp
Targets/AMDGPU.cpp
diff --git a/clang/lib/CodeGen/TargetBuiltins/AMDGPU.cpp b/clang/lib/CodeGen/TargetBuiltins/BuiltinAMDGPU.cpp
similarity index 99%
rename from clang/lib/CodeGen/TargetBuiltins/AMDGPU.cpp
rename to clang/lib/CodeGen/TargetBuiltins/BuiltinAMDGPU.cpp
index 7dccf82b1a7a3..677de2ee898a7 100644
--- a/clang/lib/CodeGen/TargetBuiltins/AMDGPU.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/BuiltinAMDGPU.cpp
@@ -1,4 +1,4 @@
-//===------- AMDCPU.cpp - Emit LLVM Code for builtins ---------------------===//
+//===------- BuiltinAMDCPU.cpp - Emit LLVM Code for builtins --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang/lib/CodeGen/TargetBuiltins/ARM.cpp b/clang/lib/CodeGen/TargetBuiltins/BuiltinARM.cpp
similarity index 99%
rename from clang/lib/CodeGen/TargetBuiltins/ARM.cpp
rename to clang/lib/CodeGen/TargetBuiltins/BuiltinARM.cpp
index 7e6a47fd7c103..327a8f5e29b27 100644
--- a/clang/lib/CodeGen/TargetBuiltins/ARM.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/BuiltinARM.cpp
@@ -1,4 +1,4 @@
-//===---------- ARM.cpp - Emit LLVM Code for builtins ---------------------===//
+//===---------- BuiltinARM.cpp - Emit LLVM Code for builtins --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang/lib/CodeGen/TargetBuiltins/DirectX.cpp b/clang/lib/CodeGen/TargetBuiltins/BuiltinDirectX.cpp
similarity index 95%
rename from clang/lib/CodeGen/TargetBuiltins/DirectX.cpp
rename to clang/lib/CodeGen/TargetBuiltins/BuiltinDirectX.cpp
index 51202331bb779..32ec59f2ffdc5 100644
--- a/clang/lib/CodeGen/TargetBuiltins/DirectX.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/BuiltinDirectX.cpp
@@ -1,4 +1,4 @@
-//===--------- DirectX.cpp - Emit LLVM Code for builtins ------------------===//
+//===--------- BuiltinDirectX.cpp - Emit LLVM Code for builtins -----------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang/lib/CodeGen/TargetBuiltins/Hexagon.cpp b/clang/lib/CodeGen/TargetBuiltins/BuiltinHexagon.cpp
similarity index 99%
rename from clang/lib/CodeGen/TargetBuiltins/Hexagon.cpp
rename to clang/lib/CodeGen/TargetBuiltins/BuiltinHexagon.cpp
index 26fe69536daa2..6204658b51985 100644
--- a/clang/lib/CodeGen/TargetBuiltins/Hexagon.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/BuiltinHexagon.cpp
@@ -1,4 +1,4 @@
-//===------ Hexagon.cpp - Emit LLVM Code for builtins ---------------------===//
+//===------ BuiltinHexagon.cpp - Emit LLVM Code for builtins --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang/lib/CodeGen/TargetBuiltins/NVPTX.cpp b/clang/lib/CodeGen/TargetBuiltins/BuiltinNVPTX.cpp
similarity index 99%
rename from clang/lib/CodeGen/TargetBuiltins/NVPTX.cpp
rename to clang/lib/CodeGen/TargetBuiltins/BuiltinNVPTX.cpp
index 6da65b681df1e..34f81e2b2a3d0 100644
--- a/clang/lib/CodeGen/TargetBuiltins/NVPTX.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/BuiltinNVPTX.cpp
@@ -1,4 +1,4 @@
-//===-------- NVPTX.cpp - Emit LLVM Code for builtins ---------------------===//
+//===-------- BuiltinNVPTX.cpp - Emit LLVM Code for builtins --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang/lib/CodeGen/TargetBuiltins/PPC.cpp b/clang/lib/CodeGen/TargetBuiltins/BuiltinPPC.cpp
similarity index 99%
rename from clang/lib/CodeGen/TargetBuiltins/PPC.cpp
rename to clang/lib/CodeGen/TargetBuiltins/BuiltinPPC.cpp
index 270e9fc976f23..c2bef235ad5a1 100644
--- a/clang/lib/CodeGen/TargetBuiltins/PPC.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/BuiltinPPC.cpp
@@ -1,4 +1,4 @@
-//===---------- PPC.cpp - Emit LLVM Code for builtins ---------------------===//
+//===---------- BuiltinPPC.cpp - Emit LLVM Code for builtins --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang/lib/CodeGen/TargetBuiltins/RISCV.cpp b/clang/lib/CodeGen/TargetBuiltins/BuiltinRISCV.cpp
similarity index 99%
rename from clang/lib/CodeGen/TargetBuiltins/RISCV.cpp
rename to clang/lib/CodeGen/TargetBuiltins/BuiltinRISCV.cpp
index b08a0588c5ac1..a6f49e9b9106e 100644
--- a/clang/lib/CodeGen/TargetBuiltins/RISCV.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/BuiltinRISCV.cpp
@@ -1,4 +1,4 @@
-//===-------- RISCV.cpp - Emit LLVM Code for builtins ---------------------===//
+//===-------- BuiltinRISCV.cpp - Emit LLVM Code for builtins --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang/lib/CodeGen/TargetBuiltins/SPIR.cpp b/clang/lib/CodeGen/TargetBuiltins/BuiltinSPIR.cpp
similarity index 99%
rename from clang/lib/CodeGen/TargetBuiltins/SPIR.cpp
rename to clang/lib/CodeGen/TargetBuiltins/BuiltinSPIR.cpp
index 243aad8bf7083..7cd0535b5a319 100644
--- a/clang/lib/CodeGen/TargetBuiltins/SPIR.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/BuiltinSPIR.cpp
@@ -1,4 +1,4 @@
-//===--------- SPIR.cpp - Emit LLVM Code for builtins ---------------------===//
+//===--------- BuiltinSPIR.cpp - Emit LLVM Code for builtins --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang/lib/CodeGen/TargetBuiltins/SystemZ.cpp b/clang/lib/CodeGen/TargetBuiltins/BuiltinSystemZ.cpp
similarity index 99%
rename from clang/lib/CodeGen/TargetBuiltins/SystemZ.cpp
rename to clang/lib/CodeGen/TargetBuiltins/BuiltinSystemZ.cpp
index a7c25b29d1dba..527d763bb6315 100644
--- a/clang/lib/CodeGen/TargetBuiltins/SystemZ.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/BuiltinSystemZ.cpp
@@ -1,4 +1,4 @@
-//===------ SystemZ.cpp - Emit LLVM Code for builtins ---------------------===//
+//===------ BuiltinSystemZ.cpp - Emit LLVM Code for builtins --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang/lib/CodeGen/TargetBuiltins/WebAssembly.cpp b/clang/lib/CodeGen/TargetBuiltins/BuiltinWebAssembly.cpp
similarity index 99%
rename from clang/lib/CodeGen/TargetBuiltins/WebAssembly.cpp
rename to clang/lib/CodeGen/TargetBuiltins/BuiltinWebAssembly.cpp
index b7fd70e855d40..e5f4f2c6e57c2 100644
--- a/clang/lib/CodeGen/TargetBuiltins/WebAssembly.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/BuiltinWebAssembly.cpp
@@ -1,4 +1,4 @@
-//===-- WebAssembly.cpp - Emit LLVM Code for builtins ---------------------===//
+//===-- BuiltinWebAssembly.cpp - Emit LLVM Code for builtins --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang/lib/CodeGen/TargetBuiltins/X86.cpp b/clang/lib/CodeGen/TargetBuiltins/BuiltinX86.cpp
similarity index 99%
rename from clang/lib/CodeGen/TargetBuiltins/X86.cpp
rename to clang/lib/CodeGen/TargetBuiltins/BuiltinX86.cpp
index e23d19d2f6b6b..4bcf572bc9025 100644
--- a/clang/lib/CodeGen/TargetBuiltins/X86.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/BuiltinX86.cpp
@@ -1,4 +1,4 @@
-//===---------- X86.cpp - Emit LLVM Code for builtins ---------------------===//
+//===---------- BuiltinX86.cpp - Emit LLVM Code for builtins --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
|
You can test this locally with the following command:git diff -U0 --pickaxe-regex -S '([^a-zA-Z0-9#_-]undef[^a-zA-Z0-9_-]|UndefValue::get)' 'HEAD~1' HEAD clang/lib/CodeGen/TargetBuiltins/BuiltinAMDGPU.cpp clang/lib/CodeGen/TargetBuiltins/BuiltinARM.cpp clang/lib/CodeGen/TargetBuiltins/BuiltinDirectX.cpp clang/lib/CodeGen/TargetBuiltins/BuiltinHexagon.cpp clang/lib/CodeGen/TargetBuiltins/BuiltinNVPTX.cpp clang/lib/CodeGen/TargetBuiltins/BuiltinPPC.cpp clang/lib/CodeGen/TargetBuiltins/BuiltinRISCV.cpp clang/lib/CodeGen/TargetBuiltins/BuiltinSPIR.cpp clang/lib/CodeGen/TargetBuiltins/BuiltinSystemZ.cpp clang/lib/CodeGen/TargetBuiltins/BuiltinWebAssembly.cpp clang/lib/CodeGen/TargetBuiltins/BuiltinX86.cpp The following files introduce new uses of undef:
Undef is now deprecated and should only be used in the rare cases where no replacement is possible. For example, a load of uninitialized memory yields In tests, avoid using For example, this is considered a bad practice: define void @fn() {
...
br i1 undef, ...
} Please use the following instead: define void @fn(i1 %cond) {
...
br i1 %cond, ...
} Please refer to the Undefined Behavior Manual for more information. |
This change will absolutely fix the issue, I was advised on my few attempts that we want to be able to keep the same name and the fix should be in cmake and not a file rename. For example We have many
And we want to be able to keep reusing the AMDGPU.cpp name but it requires us to not reuse that name in the same cmake file and to have one cmake file per directory. |
Ah, I see you tried a |
As mentioned in https://discourse.llvm.org/t/rfc-rename-source-files-in-clang-lib-codegen-targetbuiltins/87462/ it appears that MacOS's libtool warns about source filenames that are identically named, even if they exist in separate directories. Sadly, there doesn't appear to be an easy way to disable this warning, so rename these files, as these warnings are annoying for MacOS users. Fixes #133199.
e82eaa7
to
6e750e5
Compare
@farzonl I see you've tried to fix this twice before, and twice reverted CMake changes. Looking through the man page for
Is it possible that adding |
Should we just use ar/ranlib instead of libtool on Apple platform? I'm not sure how much performance difference there is between ar and libtool. |
I'm pretty sure if you use an entirely llvm based toolchain that is what is happening and you won't see this error. The problem I and other users are reporting is when you want to build llvm now with the AppleClang toolchain. That being the case I don't think the right change os to swap out libtool, but instead to fix the cmake files. |
As mentioned in https://discourse.llvm.org/t/rfc-rename-source-files-in-clang-lib-codegen-targetbuiltins/87462/ it appears that MacOS's libtool warns about source filenames that are identically named, even if they exist in separate directories.
Sadly, there doesn't appear to be an easy way to disable this warning, so rename these files, as these warnings are annoying for MacOS users.
Fixes #133199.