aboutsummaryrefslogtreecommitdiff
path: root/clang/tools
AgeCommit message (Collapse)AuthorFilesLines
2024-01-23[clang-repl] Fix CMake errors when cross compilingMartin Storsjö1-1/+1
These stem from 4821c90c24d52d4a42990fd9371caedb157bc58b. When cross compiling, CMAKE_SYSTEM_PROCESSOR is empty, if the target processor hasn't been set when setting up the cross compilation. Ideally, when setting up cross compilation with CMake, the user is supposed to set CMAKE_SYSTEM_PROCESSOR, but so far, compilation has worked just fine even without it. Quote the string where CMAKE_SYSTEM_PROCESSOR is expanded, to avoid argument errors when it expands to an empty string.
2024-01-22[clang][AIX] Only export libclang.map symbols from libclang (#78748)Jake Egan1-2/+3
This will prevent unnecessary symbols being exported in libclang, which could cause issues with non-unique objects.
2024-01-22[clang-repl] Limit use of PLT offset flag to linkers that support itStefan Gränitz1-2/+7
Follow-up fix from https://github.com/llvm/llvm-project/pull/78959
2024-01-22[clang-repl] Fix PLT offset too large linker error on ARM (#78959)Stefan Gränitz1-0/+5
I cross-compile clang-repl with GCC-10 on Ubuntu 20.04 and get this error when linking with gold: PLT offset too large, try linking with --long-plt
2024-01-21[c++20] P1907R1: Support for generalized non-type template arguments of ↵Andrey Ali Khan Bolshakov2-0/+8
scalar type. (#78041) Previously committed as 9e08e51a20d0d2b1c5724bb17e969d036fced4cd, and reverted because a dependency commit was reverted, then committed again as 4b574008aef5a7235c1f894ab065fe300d26e786 and reverted again because "dependency commit" 5a391d38ac6c561ba908334d427f26124ed9132e was reverted. But it doesn't seem that 5a391d38ac6c was a real dependency for this. This commit incorporates 4b574008aef5a7235c1f894ab065fe300d26e786 and 18e093faf726d15f210ab4917142beec51848258 by Richard Smith (@zygoloid), with some minor fixes, most notably: - `UncommonValue` renamed to `StructuralValue` - `VK_PRValue` instead of `VK_RValue` as default kind in lvalue and member pointer handling branch in `BuildExpressionFromNonTypeTemplateArgumentValue`; - handling of `StructuralValue` in `IsTypeDeclaredInsideVisitor`; - filling in `SugaredConverted` along with `CanonicalConverted` parameter in `Sema::CheckTemplateArgument`; - minor cleanup in `TemplateInstantiator::transformNonTypeTemplateParmRef`; - `TemplateArgument` constructors refactored; - `ODRHash` calculation for `UncommonValue`; - USR generation for `UncommonValue`; - more correct MS compatibility mangling algorithm (tested on MSVC ver. 19.35; toolset ver. 143); - IR emitting fixed on using a subobject as a template argument when the corresponding template parameter is used in an lvalue context; - `noundef` attribute and opaque pointers in `template-arguments` test; - analysis for C++17 mode is turned off for templates in `warn-bool-conversion` test; in C++17 and C++20 mode, array reference used as a template argument of pointer type produces template argument of UncommonValue type, and `BuildExpressionFromNonTypeTemplateArgumentValue` makes `OpaqueValueExpr` for it, and `DiagnoseAlwaysNonNullPointer` cannot see through it; despite of "These cases should not warn" comment, I'm not sure about correct behavior; I'd expect a suggestion to replace `if` by `if constexpr`; - `temp.arg.nontype/p1.cpp` and `dr18xx.cpp` tests fixed.
2024-01-21[Clang] Use const pointer to eliminate warning with libxml 2.12.0 (#76719)FantasqueX1-2/+2
Currently, if `CLANG_HAVE_LIBXML` is defined, and the version of libxml2 is above 2.12.0, there will be two warnings when building clang. warning: initializing 'xmlErrorPtr' (aka 'struct _xmlError *') with an expression of type 'const xmlError *' (aka 'const struct _xmlError *') discards qualifiers Since this commit https://gitlab.gnome.org/GNOME/libxml2/-/commit/45470611b047db78106dcb2fdbd4164163c15ab7, libxml2 makes cmlGetLastError return a const error. This patch follows libxml2. Making the result a const pointer should be compatible with versions before 2.12.0. Tested on ArchLinux with libxml2 2.12.3 installed.
2024-01-19[CMake] Detect properly new linker introduced in Xcode 15 (#77806)Eric Miotto1-2/+2
As explained in [1], this linker is functionally equivalent to the classic one (`ld64`) for build system purposes -- in particular to enable the use of order files to link `clang`. For this reason, in addition to fixing the detection rename `LLVM_LINKER_IS_LD64` to `LLVM_LINKER_IS_APPLE` to make the result of such detection more clear -- this should not cause any issue to downstream users, from a quick search in SourceGraph [2], only Swift uses the value of this variable (which I will take care of updating in due time). [1]: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking [2]: https://sourcegraph.com/search?q=context:global+LLVM_LINKER_IS_LD64+lang:cmake+fork:no+-file:AddLLVM.cmake+-file:clang/tools/driver/CMakeLists.txt&patternType=standard&sm=1&groupBy=repo rdar://120740222
2024-01-19[Clang] [NFC] Remove default argument in ASTUnit.h (#78566)Sirraide1-1/+2
This removes a default argument that is currently broken in C++23 mode due to `std::default_delete` now being `constexpr`. This is a known problem (see #74963, #59966, #69996, and a couple more), fixing which will probably take some time, so this at least makes it possible to compile `ASTUnit.h` in C++23 mode. Note that we can’t simply include the header that provides the definition of the class causing the problem either, as that would create a circular dependency.
2024-01-19[clang][ExtractAPI] Record availability information only for the target ↵Sofía Rodríguez1-2/+2
platform (#76823) Currently, ExtractAPI provides availability information for all platforms within a given domain. With this change, we narrow down the output to include availability details only for the specified target platform, so users can generate the symbol graph with only the availability information they need, omitting information of the other platforms. This change reverts the functionality introduced in [`57c9780`](https://github.com/llvm/llvm-project/commit/57c9780). rdar://120419037
2024-01-18[CUDA] Disable registering surfaces and textures with the new driverJoseph Huber1-1/+2
Summary: These runtime calls don't seem to be supported anymore, disable them for now.
2024-01-18[LinkerWrapper][Obvious] Fix move on temporary objectJoseph Huber1-1/+1
Summary: This causes warnings because it is already a temporary and does not need to be moved.
2024-01-18[LinkerWrapper] Handle AMDGPU Target-IDs correctly when linking (#78359)Joseph Huber1-36/+46
Summary: The linker wrapper's job is to sort various embedded inputs into a list of files that participate in a single link job. So far, this has been completely 1-to-1, that is, each input file participates in exactly one link job. However, support for AMD's target-id requires that one input file may participate in multiple link jobs. For example, if given a `gfx90a` static library and a `gfx90a:xnack+` object file input, we should link the gfx90a` target into the `gfx90a:xnack+` job. These are considered separate CPUs that can be mutually linked more or less. This patch adds the necessary logic to make this happen. It primarily reworks the logic to copy relevant input files into a separate list. So, it moves construction of the final list of link jobs into the extraction phase. We also need to copy the files in the case that it is needed more than once, as the entire workflow expects ownership of said file.
2024-01-18[Clang][NFC] Rename CXXMethodDecl::isPure -> is VirtualPure (#78463)cor3ntin1-1/+1
To avoid any possible confusion with the notion of pure function and the gnu::pure attribute.
2024-01-17[clang][tools] Silence const cast warning when building with Clang ToTAlexandre Ganea1-1/+13
This fixes: ``` [4960/7446] Building C object tools\clang\tools\c-index-test\CMakeFiles\c-index-test.dir\c-index-test.c.obj C:\git\llvm-project\clang\tools\c-index-test\c-index-test.c(49,19): warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual] 49 | return((char*)path); | ^ C:\git\llvm-project\clang\tools\c-index-test\c-index-test.c(239,18): warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual] 239 | free((char *)unsaved_files[i].Filename); | ^ C:\git\llvm-project\clang\tools\c-index-test\c-index-test.c(240,18): warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual] 240 | free((char *)unsaved_files[i].Contents); | ^ ```
2024-01-15[llvm][frontend][offloading] Move clang-linker-wrapper/OffloadWrapper.* to ↵Fabian Mora4-632/+11
llvm/Frontend/Offloading (#78057) This patch moves `clang/tools/clang-linker-wrapper/OffloadWrapper.*` to `llvm/Frontend/Offloading` allowing them to be re-utilized by other projects. Additionally, it makes minor modifications to the API to make it more flexible. Concretely: - The `wrap*` methods now have additional arguments `EntryArray`, `Suffix` and `EmitSurfacesAndTextures` to specify some additional options. - The `EntryArray` is now constructed by the caller. This change is needed to enable JIT compilation, as ORC doesn't fully support `__start_` and `__stop_` symbols. Thus, to JIT the code, the `EntryArray` has to be constructed explicitly in the IR. - The `Suffix` field is used when emitting the descriptor, registration methods, etc, to make them more readable. It is empty by default. - The `EmitSurfacesAndTextures` field controls whether to emit surface and texture registration code, as those functions were removed from `CUDART` in CUDA 12. It is true by default. - The function `getOffloadingEntryInitializer` was added to help create the `EntryArray`, as it returns the constant initializer and not a global variable.
2024-01-14[clang] SyntaxWarning: invalid escape sequence '\s' with Python3.12 (#78036)Jie Fu (傅杰)1-1/+1
llvm-project/clang/tools/libclang/linker-script-to-export-list.py:9: SyntaxWarning: invalid escape sequence '\s' m = re.search("^\s+(clang_[^;]+)", line) Co-authored-by: cor3ntin <corentinjabot@gmail.com>
2024-01-12[clang] Use SmallString::operator std::string() (NFC)Kazu Hirata1-1/+1
2024-01-11[llvm-driver] Fix usage of `InitLLVM` on Windows (#76306)Alexandre Ganea2-4/+0
Previously, some tools such as `clang` or `lld` which require strict order for certain command-line options, such as `clang -cc1` or `lld -flavor`, would not longer work on Windows, when these tools were linked as part of `llvm-driver`. This was caused by `InitLLVM` which was part of the `*_main()` function of these tools, which in turn calls `windows::GetCommandLineArguments`. That function completly replaces argc/argv by new UTF-8 contents, so any ajustements to argc/argv made by `llvm-driver` prior to calling these tools was reset. `InitLLVM` is now called by the `llvm-driver`. Any tool that participates in (or is part of) the `llvm-driver` doesn't call `InitLLVM` anymore.
2024-01-10[emacs] Fix Emacs library formatting (#76110)darkfeline2-0/+2
This makes it easier to ship/install these using the builtin Emacs package format (in particular, a Version is required).
2024-01-10[clang-format][NFC] Don't use clang-format style in config filesOwen Pan1-1/+6
The current CI doesn't use the latest clang-format and fails most clang-format patches on the code formatting check. This patch temporarily removes the clang-format style from the .clang-format files.
2024-01-09Reland "[clang-format] Optimize processing .clang-format-ignore files"Owen Pan1-20/+45
(42ec976184ac was reverted by 26993f61673e due to a use-after-scope bug.) Reuse the patterns governing the previous input file being formatted if the current input file is from the same directory.
2024-01-08[CMake] Add support for building on illumos (#74930)Brad Smith2-5/+16
illumos has an older version of the Solaris linker that does not support the GNU version script compat nor version scripts and does not support -Bsymbolic-functions. Treat illumos linker separately. The libclang/CMakeLists part lifted from NetBSD's pkgsrc. Build tested on Solaris 11.4 and OpenIndiana 2023.10. /usr/bin/ld --version ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.3260 ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1790 (illumos)
2024-01-05[OpenMP] Change `__tgt_device_image` to point to the image (#77003)Joseph Huber1-3/+21
Summary: We use the OffloadBinary to contain bundled offloading objects used to support many images / targets at the same time. The `__tgt_device_info` struct used to contain a pointer to this underlying binary format, which contains information about the triple and architecture. We used to parse this in the runtime to do image verification. Recent changes removed the need for this to be used internally, as we just parse it out of the ELF directly. This patch sets the pointers up so they point to the ELF without requiring any further parsing.
2024-01-04Revert "[clang-format] Optimize processing .clang-format-ignore files (#76733)"Mitch Phillips1-45/+20
This reverts commit 42ec976184acd40436acd7104ad715c60ca3e7ed. Reason: Broke the sanitizer buildbots. See more information on the github comment thread at https://github.com/llvm/llvm-project/commit/42ec976184acd40436acd7104ad715c60ca3e7ed
2024-01-03[clang-format] Optimize processing .clang-format-ignore files (#76733)Owen Pan1-20/+45
Reuse the patterns governing the previous input file being formatted if the current input file is from the same directory.
2023-12-29[clang-format] Add .clang-format-ignore for ignoring files (#76327)Owen Pan1-1/+68
Closes #52975.
2023-12-22[CMake] Move check for dlfcn.h and dladdr to clang (#76163)Abhina Sree1-2/+2
This patch checks for the presence of dlfcn.h and dladdr in clang to be used in clang/tools/libclang/CIndexer.cpp
2023-12-20Use llvm-config.h in CIndexer.cpp instead of private header (#75928)Abhina Sree1-1/+1
Use llvm-config.h in CIndexer.cpp instead of private header
2023-12-19[ClangRepl] Reland Semanic Code Completion (#75556)Fred Fu1-15/+9
This patch contains changes from 002d471a4a3cd8b429e4ca7c84fd54a642e50e4c, in addition to a bug fix that added a virtual destructor to `CompletionContextHandler` The original changes in the orginal commit piggybacks on clang's semantic modules to enable semantic completion. In particular, we use `CodeCompletionContext` to differentiate two types of code completion. We also extract the relevant type information from it.
2023-12-18[LinkerWrapper] Forward more arguments to the CPU offloading linker (#75757)Joseph Huber1-5/+25
Summary: The CPU target currently inherits all the libraries from the normal link job to ensure that it has access to the same envrionment that the host does. However, this previously was not respecting argument libraries that are passed by name rather than `-l` as well as the whole archive flags. This patch fixes this to allow the CPU linker to correctly pick up the libraries associated with things like address sanitizers. Fixes: https://github.com/llvm/llvm-project/issues/75651
2023-12-18[SystemZ][z/OS] Add guard for dl_info and dladdr (#75637)Abhina Sree1-10/+18
This patch fixes the following build error on z/OS `error: unknown type name 'Dl_info'` by adding a guard to check if we have dladdr.
2023-12-15Revert "[LinkerWrapper] Add 'Freestanding' config to the LTO pass" (#75528)fel-cab1-1/+0
This reverts commit 47d9fbc04b91fb03b6da294e82c2fb4bca6b6343. It creates a segmentation falt on SPEChpc soma on Frontier on a GPU for the kernel generate_new_beads Co-authored-by: fel-cab <fel-cab@github.com>
2023-12-13[clang-format] Fix a bug in git-clang-format.bat (#75268)Owen Pan1-1/+1
Pass the fully-qualified path name (less the file extension) of git-clang-format.bat to py so that it can be run from anywhere. Fixes #75265.
2023-12-13[clang] Use StringRef::{starts,ends}_with (NFC) (#75149)Kazu Hirata9-12/+12
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[SystemZ][z/OS] Complete EBCDIC I/O support (#75212)Abhina Sree2-1/+19
This patch completes the support for EBCDIC I/O support on z/OS using the autoconversion functions.
2023-12-11[Linkerwrapper] Make -Xoffload-linker pass directly to `clang`Joseph Huber1-1/+1
Summary: We provide `-Xoffload-linker` to pass arguments directly to the link step. Currently this uses `-Wl,` implicitly which prevents us from using clang options that we otherwise could make use of. This patch removes that implicit behavior as users can just as easiliy pass `-Xoffload-linker -Wl,-foo` if needed.
2023-12-08[clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` (#74899)Jan Svoboda2-6/+6
2023-12-08[clang-format][NFC] Clean up the driver and getStyle() in Format.cpp (#74794)Owen Pan1-23/+17
2023-12-07[LinkerWrapper][Obvious] Fix missing use of texture data typeJoseph Huber1-1/+1
Summary: This was accidentally linked to the wrong pointer, causing unused variable warnings and registering the wrong thing.
2023-12-07[CUDA][HIP] Improve variable registration with the new driver (#73177)Joseph Huber1-23/+59
Summary: This patch adds support for registering texture / surface variables from CUDA / HIP. Additionally, we now properly track the `extern` and `const` flags that are also used in these runtime functions. This does not implement the `managed` variables yet as those seem to require some extra handling I'm not familiar with. The issue is that the current offload entry isn't large enough to carry size and alignment information along with an extra global.
2023-12-05[clang-format] Add "three dot" diff option to git-clang-format (#74230)Aiden Grossman1-9/+20
This patch adds in the ability to do a "three dot" git-clang-format between two commits. This looks at the diff between the second commit and the common merge base rather than comparing at the point of the specified commits. This is needed to improve the reliability of the LLVM code formatting CI action which currently breaks in some cases where files have been modified in the upstream tree and when the person created their branch, leaving phantom formatting diffs that weren't touched by the PR author. Part of a fix for #73873
2023-12-05[clang-format][NFC] Use `prog` in clang-format-diff.py (#74399)Owen Pan1-3/+1
This is a minor improvement to #73491.
2023-12-04[clang-format] Fix a bug in `git-clang-format --binary` (#74293)Owen Pan1-1/+4
This is a rework of #74176, which erroneously changed the default clang-format filename (`clang-format`, `clang-format.exe`, etc.) to an absolute pathname. Instead, we should do that only if the name is a pathname, e.g. `./clang-format`, `llvm-project/build/bin/clang-format.exe`, etc. See also https://github.com/llvm/llvm-project/pull/74176#issuecomment-1837921351.
2023-12-03[clang-format] Fix a bug in `git-clang-format --binary` (#74176)Owen Pan1-0/+1
Fixed #74165.
2023-12-02[clang-fuzzer] Remove GCC 4.x pre GCC 4.9 workaround to silence warning (#73974)Brad Smith1-16/+0
The minimum GCC version was bumped up from 4.8 to 5.1 and then even newer awhile ago so garbage collect the pre 4.9 workaround. https://reviews.llvm.org/D66188
2023-11-30[clang-format][NFC] Reformat source code with clang-format styleOwen Pan2-7/+2
2023-11-29[clang-offload-bundler] Add support for -check-input-archive (#73709)Jacob Lambert1-0/+19
In this patch, we add support for checking a heterogeneous archive. We also significantly improve the clang-offload-bundler documentation.
2023-11-28[clang] Remove unused argument. NFC. (#73594)Juergen Ributzka2-3/+3
2023-11-28Improve clang-format-diff help output (#73491)serge-sans-paille1-3/+6
It is quite common to symlink clang-format-diff.py to clang-format-diff, and in that case the help output still refers to the .py version. Compute it instead to work in both setup.
2023-11-26[OpenMP] atomic compare fail : Parser & AST supportSunil Kuravinakop1-0/+2
Diff Revision: https://reviews.llvm.org/D123235