Age | Commit message (Collapse) | Author | Files | Lines |
|
This PR passes the VFS down to `llvm::cl` functions so that they don't
assume the real file system.
|
|
CreateProcessW requires that the environemnt block to be always double
null-terminated even with an empty environemnt.
https://learn.microsoft.com/en-us/windows/win32/procthread/environment-variables
The attached test fails this way without the fix.
C:\Users\hiroshi\upstream\llvm-project\llvm\unittests\Support\ProgramTest.cpp(697):
error: Value of: ExecutionFailed
Actual: true
Expected: false
Couldn't execute program
'C:\Users\hiroshi\upstream\llvm-project\build\unittests\Support\SupportTests.exe':
The parameter is incorrect. (0x57)
|
|
This makes it optional to define a debug type and uses the current
FileName instead. This both reduced the size of the prefix printed by
LDBG() and makes it possible to pass a filename to `--debug-only` to
filter on.
|
|
Also, improve LDBG() to accept debug type and level in any order, and
add unit-tests for LDBG() and LGDB_OS().
LDBG_OS() is a macro that behaves like LDBG() but instead of directly
using it to stream the output, it takes a callback function that will be
called with a raw_ostream.
This is a re-land with workarounds for older gcc and clang versions.
Previous attempts in #157194 and #158260
Co-authored-by: Andrzej Warzyński <andrzej.warzynski@gmail.com>
|
|
Reverts llvm/llvm-project#158260
second attempt to land this fixed some bots, but left others broken,
need an extra iteration!
|
|
Also, improve LDBG() to accept debug type and level in any order, and
add unit-tests for LDBG() and LGDB_OS().
LDBG_OS() is a macro that behaves like LDBG() but instead of directly
using it to stream the output, it takes a callback function that will be
called with a raw_ostream.
Co-authored-by: Andrzej Warzyński <andrzej.warzynski@gmail.com>
Co-authored-by: Andrzej Warzyński <andrzej.warzynski@gmail.com>
|
|
We have two forms of write:
template <typename value_type, std::size_t alignment = unaligned>
inline void write(void *memory, value_type value, endianness endian)
template <typename value_type, endianness endian, std::size_t alignment>
inline void write(void *memory, value_type value)
The difference is that endian is a function parameter in the former
but a template parameter in the latter.
This patch streamlines the code by migrating the use of the latter to
the former while deprecating the latter.
I'm planning to do the same for byte_swap and read in follow-up
patches to keep this patch simple and small.
|
|
This is a second PR on this patch (first #155572), that fixes the
linking problem for `flang-aarch64-dylib` test.
The SupportLSP library was made a component library.
---
This PR moves the generic Language Server Protocol (LSP) server support
code that was copied from clangd into MLIR, into the LLVM tree so it can
be reused by multiple subprojects.
Centralizing the generic LSP support in LLVM lowers the barrier to
building new LSP servers across the LLVM ecosystem and avoids each
subproject maintaining its own copy.
The code originated in clangd and was copied into MLIR for its LSP
server. MLIR had this code seperate to be reused by all of their LSP
server. This PR relocates the MLIR copy into LLVM as a shared component
into LLVM/Support. If this is not a suitable place, please suggest a
better one.
A follow up to this move could be deduplication with the original clangd
implementation and converge on a single shared LSP support library used
by clangd, MLIR, and future servers.
What changes
mlir/include/mlir/Tools/lsp-server-support/{Logging, Protocol,
Transport}.h moved to llvm/include/llvm/Support/LSP
mlir/lib/Tools/lsp-server-support/{Logging, Protocol, Transport}.cpp
moved to llvm/lib/Support/LSP
and their namespace was changed from mlir to llvm
I ran clang-tidy --fix and clang-format on the whole moved files (last
two commits), as they are basically new files and should hold up to the
code style used by LLVM.
MLIR LSP servers where updated to include these files from their new
location and account for the namespace change.
This PR is made as part of the LLVM IR LSP project
([RFC](https://discourse.llvm.org/t/rfc-ir-visualization-with-vs-code-extension-using-an-lsp-server/87773))
|
|
This patch renames CTLog2 to ConstantLog2 for readability.
This patch provides a forwarder under LLVM_DEPRECATED because CTLog2
is used downstream.
|
|
Reverts llvm/llvm-project#157194
Bots are broken, investigation needed.
|
|
Also, improve LDBG() to accept debug type and level in any order, and
add unit-tests for LDBG() and LGDB_OS().
LDBG_OS() is a macro that behaves like LDBG() but instead of directly
using it to stream the output, it takes a callback function that will be
called with a raw_ostream.
Co-authored-by: Andrzej Warzyński <andrzej.warzynski@gmail.com>
|
|
The `UID` variable is only being used inside the `#ifndef _WIN32` block - move
the definition into the block as well.
|
|
(#155572)"
This reverts commit c0aee322f7024250fd4a2c49f56534011178d07c.
This reverts commit a0b8d548fd250c92c8f9274b57e38ad3f0b215e9.
Fails to link with MLIR dylib build.
|
|
This PR moves the generic Language Server Protocol (LSP) server support
code that was copied from clangd into MLIR, into the LLVM tree so it can
be reused by multiple subprojects.
Centralizing the generic LSP support in LLVM lowers the barrier to
building new LSP servers across the LLVM ecosystem and avoids each
subproject maintaining its own copy.
The code originated in clangd and was copied into MLIR for its LSP
server. MLIR had this code seperate to be reused by all of their LSP
server. This PR relocates the MLIR copy into LLVM as a shared component
into `LLVM/Support`. If this is not a suitable place, please suggest a
better one.
A follow up to this move could be deduplication with the original clangd
implementation and converge on a single shared LSP support library used
by clangd, MLIR, and future servers.
### What changes
* `mlir/include/mlir/Tools/lsp-server-support/{Logging, Protocol,
Transport}.h` moved to `llvm/include/llvm/Support/LSP`
* `mlir/lib/Tools/lsp-server-support/{Logging, Protocol, Transport}.cpp`
moved to `llvm/lib/Support/LSP`
and their namespace was changed from `mlir` to `llvm`
I ran clang-tidy --fix and clang-format on the whole moved files (last
two commits), as they are basically new files and should hold up to the
code style used by LLVM.
MLIR LSP servers where updated to include these files from their new
location and account for the namespace change.
This PR is made as part of the LLVM IR LSP project
([RFC](https://discourse.llvm.org/t/rfc-ir-visualization-with-vs-code-extension-using-an-lsp-server/87773))
|
|
outputs (#113363)
Add OutputBackend and OutputFile to the `llvm::vfs` namespace for
virtualizing compiler outputs. This is intended for use in Clang,
The headers are:
- llvm/Support/VirtualOutputConfig.h
- llvm/Support/VirtualOutputError.h
- llvm/Support/VirtualOutputFile.h
- llvm/Support/VirtualOutputBackend.h
OutputFile is moveable and owns an OutputFileImpl, which is provided by
the derived OutputBackend.
- OutputFileImpl::keep() and OutputFileImpl::discard() should keep or
discard the output. OutputFile guarantees that exactly one of these
will be called before destruction.
- OutputFile::keep() and OutputFile::discard() wrap OutputFileImpl
and catch usage errors such as double-close.
- OutputFile::discardOnDestroy() installs an error handler for the
destructor to use if the file is still open. The handler will be
called if discard() fails.
- OutputFile::~OutputFile() calls report_fatal_error() if none of
keep(), discard(), or discardOnDestroy() has been called. It still
calls OutputFileImpl::discard().
- getOS() returns the wrapped raw_pwrite_stream. For convenience,
OutputFile has an implicit conversion to `raw_ostream` and
`raw_ostream &operator<<(OutputFile&, T&&)`.
OutputBackend can be stored in IntrusiveRefCntPtr.
- Most operations are thread-safe.
- clone() returns a backend that targets the same destination.
All operations are thread-safe when done on different clones.
- createFile() takes a path and an OutputConfig (see below) and returns
an OutputFile. Backends implement createFileImpl().
OutputConfig has flags to configure the output. Backends may ignore or
override flags that aren't relevant or implementable.
- The initial flags are:
- AtomicWrite: whether the output should appear atomically (e.g., by
using a temporary file and renaming it).
- CrashCleanup: whether the output should be cleaned up if there's a
crash (e.g., with RemoveFileOnSignal).
- ImplyCreateDirectories: whether to implicitly create missing
directories in the path to the file.
- Text: matches sys::fs::OF_Text.
- CRLF: matches sys::fs::OF_CRLF.
- Append: matches sys::fs::OF_Append and can use with AtomicWrite
for atomic append.
- OnlyIfDifferent: skip writting the output file if the existing file
at the output path is identical to the content to be written.
- Each "Flag" has `setFlag(bool)` and `bool getFlag()` and shortcuts
`setFlag()` and `setNoFlag()`. The setters are `constexpr` and return
`OutputConfig&` to make it easy to declare a default value for a filed
in a class or struct.
- Setters and getters for Binary and TextWithCRLF are derived from Text
and CRLF. For convenience, sys::fs::OpenFlags can be passed
directly to setOpenFlags().
This patch intentionally lacks a number of important features that have
been left for follow-ups:
- Set a (virtual) current working directory.
- Create a directory.
- Create a file or directory with a unique name (avoiding collisions
with existing filenames).
Patch originally by dexonsmith
|
|
These thread pool tests are typed and one was failing due to the setting
of environment variable `LLVM_THREADPOOL_AFFINITYMASK` leaking out of a
previous run of the test. I suspect that this has mainly succeeded
because the tests have run in separate shards.
Also the re-invocation of the unit test with the process affinity mask
set was not actually running the test because `--gtest_filter=` was not
set correctly. This has been fixed.
The use of the test type (TypeParam) in the AsyncBarrier test has been
restored. Without this the typing of these tests would be completely
redundant.
I suspect that some of these unit tests do not work if
`LLVM_ENABLE_THREADS == 0` but that is beyond the scope of this fix.
|
|
Add proxies classes for `raw_ostream` and `raw_pwrite_stream` called
`raw_ostream_proxy` and `raw_pwrite_stream_proxy`. Add adaptor classes,
`raw_ostream_proxy_adaptor<>` and `raw_pwrite_stream_proxy_adaptor<>`,
to allow subclasses to use a different parent class than `raw_ostream`
or `raw_pwrite_stream`.
The adaptors are used by a future patch to help a subclass of
`llvm::vfs::OutputFile`, an abstract subclass of `raw_pwrite_stream`, to
proxy a `raw_fd_ostream`.
Patched by dexonsmith.
|
|
We require GCC 7.4 these days, so we just need to check for
defined(__GNUC__).
|
|
A CMake change included in CMake 4.0 makes `AIX` into a variable
(similar to `APPLE`, etc.)
https://gitlab.kitware.com/cmake/cmake/-/commit/ff03db6657c38c8cf992877ea66174c33d0bcb0b
However, `${CMAKE_SYSTEM_NAME}` unfortunately also expands exactly to
`AIX` and `if` auto-expands variable names in CMake. That means you get
a double expansion if you write:
`if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")`
which becomes:
`if (AIX MATCHES "AIX")`
which is as if you wrote:
`if (ON MATCHES "AIX")`
You can prevent this by quoting the expansion of "${CMAKE_SYSTEM_NAME}",
due to policy
[CMP0054](https://cmake.org/cmake/help/latest/policy/CMP0054.html#policy:CMP0054)
which is on by default in 4.0+. Most of the LLVM CMake already does
this, but this PR fixes the remaining cases where we do not.
|
|
Add parameter to file lock API to allow exclusive file lock. Both Unix
and Windows support lock the file exclusively for write for one process
and LLVM OnDiskCAS uses exclusive file lock to coordinate CAS creation.
|
|
During the review of #150855 we switched from 0 to 1 for the default log
level used, but this macro wasn't updated.
|
|
(#153961)
Also improve a bit the LDBG() implementation
|
|
|
|
This per-file macro definition on the command line breaks caching of
modules. See discussion in #150677
Instead we use a constexpr function that processes the __FILE__ macro,
but prefer also the __FILE_NAME__ macro when available (clang/gcc) to spare
compile-time in the frontend.
If the constexpr function isn't const-evaluated, it'll be only evaluated when
printing the debug message.
|
|
Cygwin returns -1 for `getconf(_SC_ARG_MAX)`, which makes
`llvm::sys::commandLineFitsWithinSystemLimits` always return true, so
skip the `ArgumentLimit` test in that case. Skip the
`ArgumentLimitWindows` and `ResponseFileWindows` tests on Cygwin also as
it doesn't suffer from the Windows limits either.
Cygwin requires the same `dllexport` annotation as Win32 in the
`DynamicLibrary` test, so add its preprocessor check to PipSqueak.h.
Cygwin's `getcwd` function does not fail with `ENOENT` if the current
working directory is unlinked. According to POSIX issue 8, this is not
required. Skip the `PhysicalFileSystemWorkingDirFailure` test on Cygwin
as it relies on this behavior.
|
|
format (#150991)
This prefix the output with the DEBUG_TYPE.
Dialect conversion is using a ScopedPrinter, we insert the
raw_ldbg_ostream to consistently prefix each new line.
|
|
llvm::vfs::FileSystem. (#151407)
This switches to `makeIntrusiveRefCnt<FileSystem>` where creating a new
object, and to passing/returning by `IntrusiveRefCntPtr<FileSystem>`
instead of `FileSystem*` or `FileSystem&`, when dealing with existing
objects.
Part of cleanup #151026.
|
|
This allows to set an optional integer level for a given debug type. The
string format is `type[:level]`, and the integer is interpreted as such:
- if not provided: all debugging for this debug type is enabled.
- if >0: all debug that is < to the level is enabled.
- if 0: same as for >0 but also does not disable the other debug-types,
it acts as a negative filter.
The LDBG() macro is updated to accept an optional log level to
illustrate the feature. Here is the expected behavior:
LDBG() << "A"; // Identical to LDBG(1) << "A";
LDBG(2) << "B";
With `--debug-only=some_type`: we'll see A and B in the output.
With `--debug-only=some_type:1`: we'll see A but not B in the output.
With `--debug-only=some_type:2`: we'll see A and B in the output. (same
with any level above 2)
With `--debug-only=some_type:0`: we'll see neither A nor B in the
output, but we'll see any other logging for other debug types.
|
|
This PR fixes the `DEBUGLOG_WITH_STREAM_TYPE_AND_FILE` macro that got
broken in #150750. That PR introduces a more sophisitaced version of
that macro and refactored some code in that process, making the
`getShortFileName` a free function instead of a class member function,
but did not adapt this macro to the refactored code.
Signed-off-by: Ingo Müller <ingomueller@google.com>
|
|
This prints the prefix on every new line, allowing for an output that
looks like:
```
[dead-code-analysis] DeadCodeAnalysis.cpp:288 Visiting operation: func.func private @private_1() -> (i32, i32) {
[dead-code-analysis] DeadCodeAnalysis.cpp:288 %c0_i32 = arith.constant 0 : i32
[dead-code-analysis] DeadCodeAnalysis.cpp:288 %0 = arith.addi %c0_i32, %c0_i32 {tag = "one"} : i32
[dead-code-analysis] DeadCodeAnalysis.cpp:288 return %c0_i32, %0 : i32, i32
[dead-code-analysis] DeadCodeAnalysis.cpp:288 }
[dead-code-analysis] DeadCodeAnalysis.cpp:313 Visiting callable operation: func.func private @private_1() -> (i32, i32) {
[dead-code-analysis] DeadCodeAnalysis.cpp:313 %c0_i32 = arith.constant 0 : i32
[dead-code-analysis] DeadCodeAnalysis.cpp:313 %0 = arith.addi %c0_i32, %c0_i32 {tag = "one"} : i32
[dead-code-analysis] DeadCodeAnalysis.cpp:313 return %c0_i32, %0 : i32, i32
[dead-code-analysis] DeadCodeAnalysis.cpp:313 }
```
|
|
This makes the output more readable by clearly showing the current debug
type as a keyword.
|
|
Fails on windows with error
C2466: cannot allocate an array of constant size 0
else.
|
|
Add macro that mirror a common usage of logging to output .This makes it easy to have
streaming log like behavior while still using the base debug logging.
I also wanted to avoid inventing a full logging library here while enabling others to change the sink without too much pain, so put it in its own header (this also avoids making Debug depend on raw_ostream beyond forward reference). The should allow a consistent dev experience without fixing the sink too much.
---------
Co-authored-by: Mehdi Amini <joker.eph@gmail.com>
|
|
They are already implicitly convertible to the underlying type, but that
doesn't work in some contexts, and it can be useful to get the
underlying value without needing the remember/guess the right type.
I converted a couple of call sites to demonstrate usefulness, but
there's likely more of them. I know at least of at least a few in LLDB,
but I don't want to make this a cross-project patch.
|
|
.. produced by ADT/BitmaskEnum.h.
These aren't implicitly convertible to an integer, so I needed to tweak
a couple of bitwise operations and add an explicit constructor for
HexNumber and FlagEntry.
Motivation: I'd like to use this in the SFrame data structures (#147264)
|
|
This is motivated by the [SFrame format](https://discourse.llvm.org/t/rfc-adding-sframe-support-to-llvm/86900),
which contains several signed fields.
Having explicit signed operations makes the parsing code read better and
avoids potential surprises if e.g. a "signed" uint8_t value is converted
ta greater width.
|
|
Use llvm::fill instead of std::fill
|
|
Disallow calls to templated `getTrailingObjects` if there is a single
trailing type (strict mode). Add `getTrailingObjectsNonStrict` for cases
when it's not possible to know statically if there will be a single or
multiple trailing types (like in OpenMPClause.h) to bypass the struct
checks.
This will ensure that future users of TrailingObjects class do not
accidently use the templated `getTrailingObjects` when they have a
single trailing type.
|
|
This patch transforms:
X && *X == Y
to:
X == Y
where X is of std::optional<T>, and Y is of T or similar.
|
|
ArrayRef now has a new constructor that takes a parameter whose type
has data() and size(). This patch migrates:
ArrayRef<T>(X.data(), X.size()
to:
ArrayRef<T>(X)
|
|
None of the constructors touched in this patch has a corresponding
definition. This patch explicitly deletes them with "= delete" while
moving them to the public section of respective classes. Note that "=
delete" itself serves as documentation.
Identified with modernize-use-equals-delete.
|
|
This patch transforms:
X && *X == Y
to:
X == Y
where X is of std::optional<T>, and Y is of T or similar.
|
|
(FileIdx, LineNo). (#141540)
Accoring to the discussion in https://github.com/llvm/llvm-project/pull/140529, we need to SSCL can be created from multiple ignore list files, so we can repeat-fsanitize-ignorelist=. The change is necessary to achieve the feature described in https://github.com/llvm/llvm-project/issues/139128.
|
|
Issue #139128 needs to find the last one in the file.
Pull Request: https://github.com/llvm/llvm-project/pull/141697
|
|
|
|
(#141057)
A few files of llvm dir had duplicate headers included. This patch
removes those redundancies.
---------
Co-authored-by: Akash Agrawal <akashag@qti.qualcomm.com>
|
|
This patch adds a wrapper class called EncodingConverter for
ConverterEBCDIC. This class is then extended to support the ICU library
or iconv library. The ICU library currently takes priority over the
iconv library.
Relevant RFCs:
https://discourse.llvm.org/t/rfc-adding-a-charset-converter-to-the-llvm-support-library/69795
https://discourse.llvm.org/t/rfc-enabling-fexec-charset-support-to-llvm-and-clang-reposting/71512
Stacked PR to enable fexec-charset that depends on this:
https://github.com/llvm/llvm-project/pull/138895
See old PR for review and commit history:
https://github.com/llvm/llvm-project/pull/74516
|
|
`F_no_mmap` introduced by https://reviews.llvm.org/D69294 is misnamed.
It oughts to be `F_mmap`
When the output is a regular file or do not exist,
`--no-mmap-output-file` is the default. Relands #134787 by fixing the
lld option default. Note: changing the default to --map-output-file
would likely fail on llvm-clang-x86_64-sie-win
(https://lab.llvm.org/buildbot/#/builders/46/builds/14847)
Pull Request: https://github.com/llvm/llvm-project/pull/139836
|
|
- Use private inheritance for TrailingObjects as recommended in
TrailingObjects.h
- No need to define `numTrailingObjects` for the last trailing type.
- Fix comment typos.
|
|
VersionTuple::withMajorReplaced (#139318)
The expectation of this API is that it only changes the major version of
a preexisting version tuple. However, it was adding 0's, which caused
unintended changes in serialization or printing.
Instead, check for the existence of the non-major parts of the tuple.
|