41 Commits

Author SHA1 Message Date
Brad Smith
0d2e11f3e8
Remove Native Client support (#133661)
Remove the Native Client support now that it has finally reached end of life.
2025-07-15 13:22:33 -04:00
no92
0f302f38b0
[clang] Add managarm support (#144791)
This is a repost of the quickly reverted #139271. The failing buildbot
tests have been fixed and pass on my machine now.
2025-06-20 02:40:20 -04:00
Aaron Ballman
3377b56338
Revert "[clang] Add managarm support" (#144514)
Reverts llvm/llvm-project#139271

There are multiple failing build bots:
https://lab.llvm.org/buildbot/#/builders/10/builds/7482
https://lab.llvm.org/buildbot/#/builders/11/builds/17473
2025-06-17 08:39:15 -04:00
no92
e86740e600
[clang] Add managarm support (#139271)
This PR is part of a series to upstream managarm support, as laid out in
the
[RFC](https://discourse.llvm.org/t/rfc-new-proposed-managarm-support-for-llvm-and-clang-87845/85884/1).
This PR is a follow-up to #87845 and #138854.
2025-06-17 01:51:46 -04:00
jeremyd2019
52924a2d72
[Clang] [Driver] add a Cygwin ToolChain (#135691)
Add a new Cygwin toolchain that just goes through the motions to
initialize the Generic_GCC base properly. This allows removing some old,
almost certainly wrong hard-coded paths from Lex/InitHeaderSearch.cpp.

MSYS2 (GCC triple (arch)-pc-msys) is a fork of Cygwin (GCC triple
(arch)-pc-cygwin), and this driver can be used for either.

Add a simple test for this driver.
2025-05-09 09:54:02 +03:00
Ian Anderson
515b4a4fdd
[clang][Darwin] Remove legacy framework search path logic in the frontend (#138234)
Move the Darwin framework search path logic from
InitHeaderSearch::AddDefaultIncludePaths to
DarwinClang::AddClangSystemIncludeArgs. Add a new -internal-iframework
cc1 argument to support the tool chain adding these paths.
Now that the tool chain is adding search paths via cc1 flag, they're
only added if they exist, so the Preprocessor/cuda-macos-includes.cu
test is no longer relevant.
Change Driver/driverkit-path.c and Driver/darwin-subframeworks.c to do
-### style testing similar to the darwin-header-search and
darwin-embedded-search-paths tests. Rename darwin-subframeworks.c to
darwin-framework-search-paths.c and have it test all framework search
paths, not just SubFrameworks.
Add a unit test to validate that the myriad of search path flags result
in the expected search path list.

Fixes https://github.com/llvm/llvm-project/issues/75638
2025-05-08 12:30:51 -07:00
Ian Anderson
d6bfe10ac9
[Darwin][Driver][clang] apple-none-macho orders the resource directory after internal-externc-isystem when nostdlibinc is used (#122035)
Embedded development often needs to use a different C standard library,
replacing the existing one normally passed as -internal-externc-isystem.
This works fine for an apple-macos target, but apple-none-macho doesn't
work because the MachO driver doesn't implement
AddClangSystemIncludeArgs to add the resource directory as
-internal-isystem like most other drivers do. Move most of the search
path logic from Darwin and DarwinClang down into an AppleMachO toolchain
between the MachO and Darwin toolchains.

Also define __MACH__ for apple-none-macho, as Swift expects all MachO
targets to have that defined.
2025-01-07 21:13:49 -08:00
Nico Weber
ab5133bbc6 Revert "[Darwin][Driver][clang] apple-none-macho orders the resource directory after internal-externc-isystem when nostdlibinc is used (#120507)"
This reverts commit 653a54727eaa18c43447ad686c987db67f1dda74.
Breaks tests, see https://github.com/llvm/llvm-project/pull/120507#issuecomment-2575246281
2025-01-07 09:23:50 -05:00
Ian Anderson
653a54727e
[Darwin][Driver][clang] apple-none-macho orders the resource directory after internal-externc-isystem when nostdlibinc is used (#120507)
Embedded development often needs to use a different C standard library,
replacing the existing one normally passed as -internal-externc-isystem.
This works fine for an apple-macos target, but apple-none-macho doesn't
work because the MachO driver doesn't implement
AddClangSystemIncludeArgs to add the resource directory as
-internal-isystem like most other drivers do. Move most of the search
path logic from Darwin and DarwinClang down into an AppleMachO toolchain
between the MachO and Darwin toolchains.

Also define \_\_MACH__ for apple-none-macho, as Swift expects all MachO
targets to have that defined.
2025-01-06 21:33:51 -08:00
Prabhuk
dce2245ba4
[clang][driver] Cleanup UEFI toolchain driver (#111473)
Updating UEFI header includes to not include system include directories,
adding includes from compiler resource directory and minor cleanups.
2024-12-21 17:44:45 -08:00
Kazu Hirata
7642759498
[Lex] Remove unused includes (NFC) (#116460)
Identified with misc-include-cleaner.
2024-11-16 12:14:06 -08:00
Cyndy Ishida
2d48489cc3
[Clang][Darwin] Introduce SubFrameworks as a SDK default location (#115048)
* Have clang always append & pass System/Library/SubFrameworks when determining default sdk search paths.
* Teach clang-installapi to traverse there for framework input.
* Teach llvm-readtapi that the library files (TBD or binary) in there should be considered private.

resolves: rdar://137457006
2024-11-15 09:27:08 -08:00
Jan Svoboda
19b4f17d4c
[clang][lex] Remove -index-header-map (#114459)
This PR removes the `-index-header-map` functionality from Clang. AFAIK
this was only used internally at Apple and is now dead code. The main
motivation behind this change is to enable the removal of
`HeaderFileInfo::Framework` member and reducing the size of that data
structure.

rdar://84036149
2024-10-31 16:04:35 -07:00
Arthur Eubanks
d34901f30b Revert "[clang][Darwin] Remove legacy framework search path logic in the frontend (#75841)"
This reverts commit 61999b18c407b9f5c07577e63057d41c65240e61.

See comments on https://github.com/llvm/llvm-project/pull/75841. This
was intended to be NFC but actually isn't.
2024-01-02 18:09:16 +00:00
Louis Dionne
61999b18c4
[clang][Darwin] Remove legacy framework search path logic in the frontend (#75841)
This removes a long standing piece of technical debt. Most other
platforms have moved all their header search path logic to the driver,
but Darwin still had some logic for setting framework search paths
present in the frontend. This patch moves that logic to the driver
alongside existing logic that already handles part of these search
paths.

This is intended to be a pure refactor without any functional change
visible to users, since the search paths before and after should be the
same, and in the same order. The change in the tests is necessary
because we would previously add the DriverKit framework search path in
the frontend regardless of whether we actually need to, which we now
handle correctly because the driver checks for ld64-605.1+.

Fixes #75638
2023-12-31 05:15:49 -05:00
Kazu Hirata
f3dcc2351c
[clang] Use StringRef::{starts,ends}_with (NFC) (#75149)
This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
2023-12-13 08:54:13 -08:00
Aaron Ballman
3293c088c2 Remove dead code; NFC
This code was added 17 years ago but never enabled or tested. GCC warns
that -I- is deprecated for them, and Clang gives an error when passed
-I-, so we may as well remove this code rather than hook it up to the
driver and maintain it.
2023-12-07 08:26:33 -05:00
Jan Svoboda
89bacc0bb9 [clang] NFCI: Use FileEntryRef in CreateHeaderMap() 2023-09-09 21:51:04 -07:00
Fangrui Song
c998106a7f [Lex] Remove unused AddGnuCPlusPlusIncludePaths after e75f240a0432d827c28a5d77fad26a099ceb7a72 2023-09-06 22:25:47 -07:00
Brad Smith
f3476332e4 [Driver] move DragonFly header search path management to the driver
As has been done for other OS's. Move the header path management to the driver.

Also I noticed with D89690 that the library paths were updated for GCC 8, but
the C++ header path was not. So I also fixed that while here.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D158376
2023-08-29 23:18:42 -04:00
Brad Smith
d267990e8c [Driver] move ELFIAMCU / RTEMS header search path management to the driver
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D158132
2023-08-29 23:04:02 -04:00
Brad Smith
5165593a97 Delete CloudABI support
After this D108637 and with FreeBSD -current and now 14 dropping support for
CloudABI I think it is time to consider deleting the CloudABI support.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D158920
2023-08-29 22:57:30 -04:00
Brad Smith
196ff0c7dd [Driver] Add LiteOS and z/OS to ShouldAddDefaultIncludePaths()
LiteOS (OHOS) and z/ZOS already have header path handling in the Driver, so add
the OS's to ShouldAddDefaultIncludePaths().

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D159042
2023-08-28 23:01:50 -04:00
Brad Smith
e4cb692526 [Driver] Add NaCl to ShouldAddDefaultIncludePaths()
The Driver for NaCl already handled the header paths so disable
the default fallback path.
2023-08-24 21:09:09 -04:00
Brad Smith
e75f240a04 [Driver] Cleanup last vestiges of Minix / Contiki support
Cleanup what is left after D158461.

Reviewed by: MaskRay

Differential Revision:
2023-08-24 20:04:40 -04:00
Brad Smith
aa2c701b5d [Driver] move Haiku header search path management to the driver
Also while here sync the header paths with the Haiku GCC configuration.

Added: /boot/system/develop/headers/gnu
Removed: /boot/system/develop/headers/os/arch

https://github.com/haikuports/haikuports/tree/master/sys-devel/gcc/patches

Reviewed By: nielx

Differential Revision: https://reviews.llvm.org/D157767
2023-08-15 19:58:40 -04:00
Jan Svoboda
6587d9d87a [clang] NFCI: Use DirectoryEntryRef for ModuleMap::BuiltinIncludeDir
This removes some uses of the deprecated `DirectoryEntry::getName()`.
2023-05-31 14:54:42 -07:00
Archibald Elliott
62c7f035b4 [NFC][TargetParser] Remove llvm/ADT/Triple.h
I also ran `git clang-format` to get the headers in the right order for
the new location, which has changed the order of other headers in two
files.
2023-02-07 12:39:46 +00:00
Paul Robinson
ecb3cd0946 [Driver] Move PS4/PS5 header search path management to the driver
This follows how OpenBSD, FreeBSD, and NetBSD now work. (See
D138183 and D140817 for those cases.)

It also tidies up some code duplication that wasn't exactly right.
2023-02-01 07:40:30 -08:00
Kazu Hirata
6ad0788c33 [clang] Use std::optional instead of llvm::Optional (NFC)
This patch replaces (llvm::|)Optional< with std::optional<.  I'll post
a separate patch to remove #include "llvm/ADT/Optional.h".

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14 12:31:01 -08:00
Kazu Hirata
a1580d7b59 [clang] Add #include <optional> (NFC)
This patch adds #include <optional> to those files containing
llvm::Optional<...> or Optional<...>.

I'll post a separate patch to actually replace llvm::Optional with
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14 11:07:21 -08:00
Brad Smith
8fd279f7d3 [Driver] move Fuchsia header search path management to the driver
Fuchsia already implements AddClangSystemIncludeArgs(). So it looks like we
just have to switch over to using it.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D141073
2023-01-05 21:21:08 -05:00
Brad Smith
e449e1dff9 [Driver] move NetBSD header search path management to the driver
This matches OpenBSD and FreeBSD. https://reviews.llvm.org/D138183

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D140817
2023-01-05 06:13:40 -05:00
Kazu Hirata
5891420e68 [clang] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-03 11:54:46 -08:00
Matt Jacobson
ba7a1d9e4a [Driver] move FreeBSD header search path management to the driver
This matches OpenBSD, and it supports Swift's use of clang for its C interop
functionality.  Recent changes to Swift use AddClangSystemIncludeArgs() to
inspect the cc1 args; this doesn't work for platforms where cc1 adds standard
include paths implicitly.  See:

<cf3354222d>

Also clean up InitHeaderSearch, making it clearer which targets manage header
search paths in the driver.

Differential Revision: https://reviews.llvm.org/D138183
2022-11-18 02:29:49 -05:00
Julian Lettner
dc32ed8a8e [Clang][Driver] Refine/refactor DriverKit support
Add special Framework header search path for DriverKit.
2022-08-26 16:06:24 -07:00
Fangrui Song
3f18f7c007 [clang] LLVM_FALLTHROUGH => [[fallthrough]]. NFC
With C++17 there is no Clang pedantic warning or MSVC C5051.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D131346
2022-08-08 09:12:46 -07:00
Paul Robinson
7726ad04e2 [PS5] Add basic PS5 driver behavior
This adds a PS5-specific ToolChain subclass, which defines some basic
PS5 driver behavior. Future patches will add more target-specific
driver behavior.
2022-04-14 12:45:33 -07:00
Paul Robinson
1e085448b3 [PS4] Fix header search list
A missing "break" in the initial implementation had us adding a
spurious "/usr/include" to the header search list. Later someone
introduced LLVM_FALLTHROUGH to prevent a warning.  Replace this with
the correct "break" and make sure the extra directory isn't added to
the PS4 header search list.
2022-04-05 14:14:13 -07:00
Paul Robinson
7b85f0f32f [PS4] isPS4 and isPS4CPU are not meaningfully different 2022-03-03 11:36:59 -05:00
Jan Svoboda
f77d115cc1 [clang] Move ApplyHeaderSearchOptions from Frontend to Lex
In D116750, the `clangFrontend` library was added as a dependency of `LexTests` in order to make `clang::ApplyHeaderSearchOptions()` available. This increased the number of TUs the test depends on.

This patch moves the function into `clangLex` and removes dependency of `LexTests` on `clangFrontend`.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D117024
2022-01-11 17:57:40 +01:00