Commit Graph

22 Commits

Author SHA1 Message Date
Nico Weber
9d5359d1f8 [Demangling] Remove includes of swift/Basic/Assertions.h
They are not used. Demangling uses `assert()` from <cassert>,
and macros from lib/Demangling/DemanglerAssert.h.

Reverts the lib/Demangling changes from #74184.

No behavior change.
2024-08-05 12:16:00 -04:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
Ben Barham
1fdda023b3 Rename StringRef::endswith references to StringRef::ends_with
Missed this when doing the `startswith` renaming. `endswith` has also
been deprecated upstream (and presumably soon to be removed).
2024-04-01 10:59:16 -07:00
Ben Barham
9779c18da3 Rename startswith to starts_with
LLVM is presumably moving towards `std::string_view` -
`StringRef::startswith` is deprecated on tip. `SmallString::startswith`
was just renamed there (maybe with some small deprecation inbetween, but
if so, we've missed it).

The `SmallString::startswith` references were moved to
`.str().starts_with()`, rather than adding the `starts_with` on
`stable/20230725` as we only had a few of them. Open to switching that
over if anyone feels strongly though.
2024-03-13 22:25:47 -07:00
Alastair Houghton
54ea4b2d80 [Demangler] Fix isThunkSymbol() and getThunkTarget() to handle continuations.
`isThunkSymbol()` was returning false for await resume and suspend resume thunks
because the `Node` tree for those has an `AsyncAwaitResumePartialFunction`
and/or `AsyncSuspendResumePartialFunction` as the first child of the top level
`Global`, with the actual thunk in the _second_ child location.

rdar://100424460
2022-09-29 12:17:41 +01:00
Kuba (Brecka) Mracek
4511c474ea Avoid depending on missing nodeToString and genericParameterName symbols in the freestanding stdlib (#42174) 2022-04-06 08:37:28 -07:00
Kuba (Brecka) Mracek
557bf685be Don't include support for old mangling in runtimes without ObjC interop (#39675) 2021-10-13 19:47:05 -07:00
Alastair Houghton
8be084f30a Merge pull request #39187 from al45tair/problem/79725187
[Demangler] Improve remangler error handling
2021-09-27 17:03:49 +01:00
Kuba (Brecka) Mracek
80519fb7e2 Avoid using system isdigit in favor of swift::Mangle::isDigit (#39382) 2021-09-21 17:36:18 -07:00
Alastair Houghton
fbf082b6cb [Demangling] Make Demangle::getUnspecialized() return errors too.
This lets us completely remove the unreachable() function from Remangler.cpp.

rdar://79725187
2021-09-06 17:49:09 +01:00
Tony Allevato
5b1daa9055 Conditionally wrap (de)mangling symbols in an inline namespace.
Since libDemangling is included in the Swift standard library,
ODR violations can occur on platforms that allow statically
linking stdlib if Swift code is linked with other compiler
libraries that also transitively pull in libDemangling, and if
the stdlib version and compiler version do not match exactly
(even down to commit drift between releases). This lets the
runtime conditionally segregate its copies of the libDemangling
symbols from those in the compiler using an inline namespace
without affecting usage throughout source.
2020-06-19 11:20:56 -07:00
Erik Eckstein
65bbb9c4c3 Demangler: handle symbols with .<n> suffix in isThunkSymbol()
rdar://problem/48382772
2019-04-23 11:15:18 -07:00
Erik Eckstein
706f4c8622 Demangler library: add a function swift_demangle_getModuleName to get the module name of a mangled symbol.
rdar://problem/47560963
2019-02-19 11:26:42 -08:00
Doug Gregor
735a83bb8d [Mangling] Separate mangling for associated/base conformance accessors.
It’s simpler to use separate manglings for these two cases.
2018-12-04 00:34:05 -08:00
Erik Eckstein
14697d72f2 demangler: classify allocating init functions as thunks
rdar://problem/45170658
2018-10-16 10:28:17 -07:00
Doug Gregor
1e769e13fe [Demangler] Eliminate a use-of-uninitialized in misuse of StringRef.
Putting the results of StringRef::data() back into a StringRef scans for the
null at the end, which won’t always be there. Caught by ASan.
2017-09-24 10:37:16 -07:00
Erik Eckstein
79c522a49d demangler: Support the future final mangling prefix $S
As it’s not clear if we will need underscores, the demangler accepts $S and _$S.
Note that a double underscore is handled by the demangler client.

rdar://problem/32251811
2017-06-26 11:32:26 -07:00
Erik Eckstein
52aa8ef94b demangler: classify reabstruction thunks as thunks 2017-05-11 16:02:21 -07:00
practicalswift
431e5a1440 [gardening] Use consistent end of namespace comments 2017-04-20 13:47:10 +02:00
Erik Eckstein
8dcdb7a193 Mangler: Classify protocol witnesses as thunks.
Protocol witnesses just call the actual implementation in the conforming type.
2017-04-13 15:41:07 -07:00
Erik Eckstein
d70bfc5de2 rename namespace NewMangling -> Mangle 2017-03-20 10:09:30 -07:00
Erik Eckstein
5e80555c9b demangler: put the demangler into a separate library
Previously it was part of swiftBasic.

The demangler library does not depend on llvm (except some header-only utilities like StringRef). Putting it into its own library makes sure that no llvm stuff will be linked into clients which use the demangler library.

This change also contains other refactoring, like moving demangler code into different files. This makes it easier to remove the old demangler from the runtime library when we switch to the new symbol mangling.

Also in this commit: remove some unused API functions from the demangler Context.

fixes rdar://problem/30503344
2017-03-09 13:42:43 -08:00