summaryrefslogtreecommitdiff
path: root/lld/Common/Strings.cpp
AgeCommit message (Collapse)Author
2025-01-15[lld] Initialize SingleStringMatcher::ExactMatch (#123138)Vitaly Buka
It was not set false in all branches.
2023-08-08[GlobPattern] Update invalid glob pattern diagnostic for unmatched '['Fangrui Song
Update this diagnostic to mention the reason (unmatched '['), matching the other diagnostic about stray '\'. The original pattern is omitted, as some users may mention the original pattern in another position, not repeating it.
2023-06-25[llvm] Add missing StringExtras.h includesElliot Goodrich
In preparation for removing the `#include "llvm/ADT/StringExtras.h"` from the header to source file of `llvm/Support/Error.h`, first add in all the missing includes that were previously included transitively through this header.
2023-06-05[lld] StringRef::{starts,ends}with => {starts,ends}_with. NFCFangrui Song
The latter form is now preferred to be similar to C++20 starts_with. This replacement also removes one function call when startswith is not inlined.
2022-07-30[lld] Change vector to SmallVector. NFCFangrui Song
My lld executable is 1.6KiB smaller and some functions are now more efficient.
2022-01-05[lld] Add support for other demanglers other than ItaniumLuís Ferreira
LLVM core library supports demangling other mangled symbols other than itanium, such as D and Rust. LLD should use those demanglers in order to output pretty demangled symbols on error messages. Reviewed By: MaskRay, #lld-macho Differential Revision: https://reviews.llvm.org/D116279
2021-12-30Revert "[lld] Add support for other demanglers other than Itanium"Luís Ferreira
This reverts commit e60d6dfd5acdc821d391ad5af2c706397bdfd36a. clang-ppc64le-rhel buildbot failed (https://lab.llvm.org/buildbot#builders/57/builds/13424): tools/lld/MachO/CMakeFiles/lldMachO.dir/Symbols.cpp.o: In function `lld::demangle(llvm::StringRef, bool)': Symbols.cpp:(.text._ZN3lld8demangleEN4llvm9StringRefEb[_ZN3lld8demangleEN4llvm9StringRefEb]+0x90): undefined reference to `llvm::demangle(std::string const&)'
2021-12-30[lld] Add support for other demanglers other than ItaniumLuís Ferreira
LLVM core library supports demangling other mangled symbols other than itanium, such as D and Rust. LLD should use those demanglers in order to output pretty demangled symbols on error messages. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D116279
2021-03-11[ELF] Simplify isValidCIdentifier. NFCFangrui Song
2020-11-24clang+lld: Improve clang+ld.darwinnew.lld interaction, pass -demangleNico Weber
This patch: - adds an ld64.lld.darwinnew symlink for lld, to go with f2710d4b576, so that `clang -fuse-ld=lld.darwinnew` can be used to test new Mach-O lld while it's in bring-up. (The expectation is that we'll remove this again once new Mach-O lld is the defauld and only Mach-O lld.) - lets the clang driver know if the linker is lld (currently only triggered if `-fuse-ld=lld` or `-fuse-ld=lld.darwinnew` is passed). Currently only used for the next point, but could be used to implement other features that need close coordination between compiler and linker, e.g. having a diag for calling `clang++` instead of `clang` when link errors are caused by a missing C++ stdlib. - lets the clang driver pass `-demangle` to Mach-O lld (both old and new), in addition to ld64 - implements -demangle for new Mach-O lld - changes demangleItanium() to accept _Z, __Z, ___Z, ____Z prefixes (and updates one test added in D68014). Mach-O has an extra underscore for symbols, and the three (or, on Mach-O, four) underscores are used for block names. Differential Revision: https://reviews.llvm.org/D91884
2020-05-28FileOutputBuffer.h - remove unused includes. NFC.Simon Pilgrim
Move dependent includes down to source files where necessary.
2020-01-28Make llvm::StringRef to std::string conversions explicit.Benjamin Kramer
This is how it should've been and brings it more in line with std::string_view. There should be no functional change here. This is mostly mechanical from a custom clang-tidy check, with a lot of manual fixups. It uncovers a lot of minor inefficiencies. This doesn't actually modify StringRef yet, I'll do that in a follow-up.
2020-01-22[lld/ELF] PR44498: Support input filename in double quoteThomas Preud'homme
Summary: Linker scripts allow filenames to be put in double quotes to prevent characters in filenames that are part of the linker script syntax from having their special meaning. Case in point the * wildcard character. Availability of double quoting filenames also allows to fix a failure in ELF/linkerscript/filename-spec.s when the path contain a @ which the lexer consider as a special characters and thus break up a filename containing it. This may happens under Jenkins which createspath such as pipeline@2. To avoid the need for escaping GlobPattern metacharacters in filename in double quotes, GlobPattern::create is augmented with a new parameter to request literal matching instead of relying on the presence of a wildcard character in the pattern. Reviewers: jhenderson, MaskRay, evgeny777, espindola, alexshap Reviewed By: MaskRay Subscribers: peter.smith, grimar, ruiu, emaste, arichardson, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72517
2019-09-27[LLD] Simplify the demangleItanium function. NFC.Martin Storsjo
Instead of returning an optional, just return the input string if demangling fails, as that's what all callers use anyway. Differential Revision: https://reviews.llvm.org/D68015 llvm-svn: 373077
2019-09-27[LLD] Convert demangleItanium to use the higher level llvm::demangle ↵Martin Storsjo
function. NFC. This avoids a few lines of boilerplate of dealing with C string allocations. Add a testcase for a case where demangling shouldn't happen. Differential Revision: https://reviews.llvm.org/D68014 llvm-svn: 373076
2019-09-27[LLD] [COFF] Use the unified llvm demangle frontend function. NFC.Martin Storsjo
Add test cases for some cases where we don't want demangling to happen. Differential Revision: https://reviews.llvm.org/D67301 llvm-svn: 373075
2019-08-05Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song
F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
2019-07-11[Coding style change][lld] Rename variables for non-ELF portsRui Ueyama
This patch does the same thing as r365595 to other subdirectories, which completes the naming style change for the entire lld directory. With this, the naming style conversion is complete for lld. Differential Revision: https://reviews.llvm.org/D64473 llvm-svn: 365730
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-09-17lld-link: Also demangle undefined dllimported symbols.Nico Weber
dllimported symbols go through an import stub that's called __imp_ followed by the name the stub points to. Make that work. Differential Revision: https://reviews.llvm.org/D52145 llvm-svn: 342401
2018-09-15lld-link: print demangled symbol names for "undefined symbol" diagnosticsNico Weber
For this, add a few toString() calls when printing the "undefined symbol" diagnostics; toString() already does demangling on Windows hosts. Also make lld::demangleMSVC() (called by toString(Symbol*)) call LLVM's microsoftDemangle() instead of UnDecorateSymbolName() so that it works on non-Windows hosts – this makes both updating tests easier and provides a better user experience for people doing cross-links. This doesn't yet do the right thing for symbols starting with __imp_, but that can be improved in a follow-up. Differential Revision: https://reviews.llvm.org/D52104 llvm-svn: 342332
2018-05-22Code cleanup in preparation for adding LTO for wasm. NFC.Sam Clegg
- Move some common code into Common/rrorHandler.cpp and Common/Strings.h. - Don't use `fatal` when incompatible bitcode files are encountered. - Rename NameRef variable to just Name See D47162 Differential Revision: https://reviews.llvm.org/D47206 llvm-svn: 333021
2018-02-28Make sure that clang-format doesn't reorder include files.Rui Ueyama
clang-format won't reorder include files if there is a blank line. Thanks to Nico for the tips. llvm-svn: 326371
2018-02-28Attempt to build breakage caused by r326339.Rui Ueyama
clang-format automatically sorted the #include lines, but I believe Windows.h needs to be included before Dbghelp.h. llvm-svn: 326360
2018-02-28Merge {COFF,ELF}/Strings.cpp to Common/Strings.cpp.Rui Ueyama
This should resolve the issue that lld build fails in some hosts that uses case-insensitive file system. Differential Revision: https://reviews.llvm.org/D43788 llvm-svn: 326339
2017-11-28Factor out common code to Common/Strings.cpp.Rui Ueyama
Differential Revision: https://reviews.llvm.org/D40530 llvm-svn: 319138