33 Commits

Author SHA1 Message Date
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Hamish Knight
7982e4bd7e [AST] Handle null in printDeclDescription
Sink down the null Decl printing into
`printDeclDescription` such that all callers
benefit from it.

This is an attempt at fixing at least the secondary
crash in rdar://113491294, it does not address the
underlying crash.
2023-08-21 15:35:16 +01:00
Evan Wilde
250082df25 [NFC] Reformat all the LLVMs
Reformatting everything now that we have `llvm` namespaces. I've
separated this from the main commit to help manage merge-conflicts and
for making it a bit easier to read the mega-patch.
2023-06-27 09:03:52 -07:00
Evan Wilde
f3ff561c6f [NFC] add llvm namespace to Optional and None
This is phase-1 of switching from llvm::Optional to std::optional in the
next rebranch. llvm::Optional was removed from upstream LLVM, so we need
to migrate off rather soon. On Darwin, std::optional, and llvm::Optional
have the same layout, so we don't need to be as concerned about ABI
beyond the name mangling. `llvm::Optional` is only returned from one
function in
```
getStandardTypeSubst(StringRef TypeName,
                     bool allowConcurrencyManglings);
```
It's the return value, so it should not impact the mangling of the
function, and the layout is the same as `std::optional`, so it should be
mostly okay. This function doesn't appear to have users, and the ABI was
already broken 2 years ago for concurrency and no one seemed to notice
so this should be "okay".

I'm doing the migration incrementally so that folks working on main can
cherry-pick back to the release/5.9 branch. Once 5.9 is done and locked
away, then we can go through and finish the replacement. Since `None`
and `Optional` show up in contexts where they are not `llvm::None` and
`llvm::Optional`, I'm preparing the work now by going through and
removing the namespace unwrapping and making the `llvm` namespace
explicit. This should make it fairly mechanical to go through and
replace llvm::Optional with std::optional, and llvm::None with
std::nullopt. It's also a change that can be brought onto the
release/5.9 with minimal impact. This should be an NFC change.
2023-06-27 09:03:52 -07:00
Rintaro Ishizaki
86d405bcd0 [Macros] Unify MacroExpansionDecl/MacroExpansionExpr expansion logic
'MacroExpansionDecl' and 'MacroExpansionExpr' have many common methods.
Introduce a common base class 'FreestandingMacroExpansion' that holds
'MacroExpansionInfo'.

Factor out common expansion logic to 'evaluateFreestandingMacro'
function that resembles 'evaluateAttachedMacro'.
2023-06-02 11:54:05 -07:00
zoecarver
13e64f3a3f [nfc][cxx-interop] Add some pretty stack traces for various things that crash a lot. 2022-03-17 16:54:54 -07:00
Slava Pestov
2a1b985f9e AST: PrettyStackTraceConformance doesn't need to take the ASTContext 2021-03-05 21:30:14 -05:00
Nathan Hawes
f0c8b8e571 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	include/swift/AST/PrettyStackTrace.h
2020-08-14 11:06:27 -07:00
David Zarzycki
1e940c2c7e [NFC] Fix -Wsuggest-override warnings
LLVM, as of 77e0e9e17daf0865620abcd41f692ab0642367c4, now builds with
-Wsuggest-override. Let's clean up the swift sources rather than disable
the warning locally.
2020-08-13 16:17:46 -04:00
Nathan Hawes
4fd0cdc2ef Fix up calls to clang::Type::dump() now that it requires a clang::ASTContext. 2020-07-07 15:05:34 -07:00
Anthony Latsis
b68d827032 [NFC] AST: const-qualify ASTContext refs in PrettyStackTrace.h 2020-06-05 16:31:52 +03:00
Rintaro Ishizaki
de6a402116 [CodeCompletion] Add pretty stacktrace for completion operation 2020-04-10 09:28:40 -07:00
Dan Zheng
a174243159 [AutoDiff upstream] Add SIL differentiability witness IRGen. (#29704)
SIL differentiability witnesses are a new top-level SIL construct mapping
an "original" SIL function and derivative configuration to derivative SIL
functions.

This patch adds `SILDifferentiabilityWitness` IRGen.

`SILDifferentiabilityWitness` has a fixed `{ i8*, i8* }` layout:
JVP and VJP derivative function pointers.

Resolves TF-1146.
2020-02-07 14:10:34 -08:00
John McCall
b3750a7c13 Add a PrettyStackTrace for working with Clang types. 2020-02-06 12:09:05 -05:00
Robert Widmann
5a8d0744c3 [NFC] Adopt TypeBase-isms for GenericSignature
Structurally prevent a number of common anti-patterns involving generic
signatures by separating the interface into GenericSignature and the
implementation into GenericSignatureBase.  In particular, this allows
the comparison operators to be deleted which forces callers to
canonicalize the signature or ask to compare pointers explicitly.
2019-09-30 14:04:36 -07:00
Slava Pestov
ef1821e420 Sema: Add a pretty stack for capture computation 2019-08-07 15:45:08 -04:00
John McCall
6ffeb4d839 [NFC] Add PrettyStackTraceConformance and use it
Also allow the printFooDescription functions to suppress
the trailing newline.
2018-11-15 18:39:35 -05:00
Jordan Rose
85275d278e Add some more PrettyStackTrace entries to AST (#17208)
No functionality change.
2018-06-14 13:55:52 -07:00
Doug Gregor
c5fe5c47c9 [AST] Verify canonicalization of generic signatures.
When we canonicalize a generic signature, ensure that the resulting
signature has canonical requirements in the appropriate order.
More validation for generic signature canonicalization as part of the
ABI, which is tracked by SR-3733 / rdar://problem/31412994.
2017-11-06 21:22:36 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
8c5b8e5186 Fix typo: dagnostic → diagnostic 2015-12-14 00:11:33 +01:00
Dmitri Hrybenko
0ac3f6f299 Allow const Decls to be used with PrettyStackTraceDecl
Swift SVN r15045
2014-03-14 12:37:01 +00:00
John McCall
0f97e9307c Extract out a function to print a SourceLoc for pretty stack traces.
Swift SVN r10339
2013-11-11 19:52:32 +00:00
Doug Gregor
a85ef1e7c4 Introduce stack trace information for resolving type representations.
This should help give a slightly better experience for out-of-order
type checking issues until we manage to make type checking
order-independent. <rdar://problem/14702636>.


Swift SVN r7149
2013-08-12 14:59:13 +00:00
Dmitri Hrybenko
3d37954e81 Remove SourceManager::decompose() and switch its clients to normal location and
range printing


Swift SVN r7122
2013-08-10 02:19:50 +00:00
John McCall
fcd998a48b PrettyStackTrace enhancements for SIL constructs.
Swift SVN r6966
2013-08-07 00:10:57 +00:00
John McCall
77b62557a6 Add a pretty stack trace entry for a type (and a newline to
the generic source-location printer).

Swift SVN r4922
2013-04-26 18:48:36 +00:00
John McCall
14aa93a382 Publicize an API for printing out a source location for
debugging purposes.  Add a PrettyStackTraceLocation for
noting that we're currently processing a fixed location.



Swift SVN r1096
2012-01-26 00:07:05 +00:00
John McCall
b2569c7786 Provide PrettyStackTraceEntries for Expr* and Stmt* as well,
and type-check functions within the former.



Swift SVN r989
2011-12-23 03:53:23 +00:00
John McCall
5bdea18fc4 Introduce a PrettyStackTraceEntry implementation for
processing declarations and use it in debug builds whenever
the tree walker walks into a Decl.



Swift SVN r984
2011-12-23 01:58:26 +00:00