Commit Graph

34 Commits

Author SHA1 Message Date
Hamish Knight
5be3ef65d3 [AST] Add some ASTNode constructors for lldb
These seem to be needed to allow the conversion to
ASTNode in lldb.
2024-01-31 11:16:36 +00:00
Alex Hoppen
aa9c00f0d0 [AST] Make ASTNode pointer-like 2023-02-22 22:31:08 +01:00
Doug Gregor
f467ef4d37 [Source manager] Start tracking generated-source info in the source manager
Establish the relationship for generated sources, whether for macro
expansions or (via a small stretch) replacing function bodies with
other bodies, in the source manager itself. This makes the information
available for diagnostic rendering, and unifies a little bit of the
representation, although it isn't used for much yet.
2022-12-14 23:02:27 -08:00
Alex Hoppen
9dbd5829de [CodeCompletion] Support type checking attributes even if they are not part of the AST
The code completion might occur inside an attriubte that isn’t part of the AST because it’s missing a `VarDecl` that it could be attached to. In these cases, record the `CustomAttr` and type check it standalone, pretending it was part of a `DeclContext`.

This also fixes a few issues where code completion previously wouldn’t find the attribute constructor call and thus wasn’t providing code completion inside the property wrapper.

rdar://92842803
2022-05-07 08:58:52 +02:00
Pavel Yaskevich
da3856c45b Merge pull request #41369 from haikusw/patch-1
Update what seems like an outdated comment
2022-02-17 17:02:53 -08:00
Tyler
6e226ba51f restore accidentally omitted trailing period. 2022-02-15 14:13:22 -08:00
Tyler
59d54edce1 Update what seems like an outdated comment
Totally minor, but I was taking a look at the source for educational purposes and noticed that it seems ASTNode evolved to be a union of a few additional types without the file comment being updated.   Updated to reflect the code, if I understand it correctly.
2022-02-13 23:29:34 -08:00
Pavel Yaskevich
0cc8bc7928 [CSClosure] SE-0326: Type-checker statement conditions individually
Instead of referencing whole statement condition, break it down to
individual elements and solve them separately.

Resolves: rdar://88720312
2022-02-12 10:01:58 -08:00
Pavel Yaskevich
df00e3efbe [ASTNode] Add a new element - case item 2021-10-08 10:08:02 -07:00
Pavel Yaskevich
15aa8edf75 [ASTNode] Add a new element - statement condition 2021-10-08 10:08:01 -07:00
Anthony Latsis
4b4634141f Sema: Remove TypeLoc from ExplicitCast 2020-06-09 15:20:25 +03:00
Pavel Yaskevich
0b4404b51e [AST/Parser] Convert TypeLoc struct into aligned class 2020-04-29 17:03:45 -07:00
Pavel Yaskevich
87b8f79d2c [AST] Extend ASTNode to support Pattern/TypeLoc 2020-04-29 17:03:45 -07:00
Brent Royal-Gordon
99faa033fc [NFC] Standardize dump() methods in frontend
By convention, most structs and classes in the Swift compiler include a `dump()` method which prints debugging information. This method is meant to be called only from the debugger, but this means they’re often unused and may be eliminated from optimized binaries. On the other hand, some parts of the compiler call `dump()` methods directly despite them being intended as a pure debugging aid. clang supports attributes which can be used to avoid these problems, but they’re used very inconsistently across the compiler.

This commit adds `SWIFT_DEBUG_DUMP` and `SWIFT_DEBUG_DUMPER(<name>(<params>))` macros to declare `dump()` methods with the appropriate set of attributes and adopts this macro throughout the frontend. It does not pervasively adopt this macro in SILGen, SILOptimizer, or IRGen; these components use `dump()` methods in a different way where they’re frequently called from debugging code. Nor does it adopt it in runtime components like swiftRuntime and swiftReflection, because I’m a bit worried about size.

Despite the large number of files and lines affected, this change is NFC.
2019-10-31 18:37:42 -07:00
Gwen Mittertreiner
dff6b6e258 Removed uses of PointerUnion3
PointerUnion was generalized to be variadic. Replaced uses of
PointerUnion3 with PointerUnion

See also: git-svn-id:
https://llvm.org/svn/llvm-project/llvm/trunk@360962
91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-20 16:02:41 -07:00
Brent Royal-Gordon
e6af2e4ad9 Add ASTNode.dump() methods 2019-02-17 22:14:21 -08:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
Slava Pestov
0715eaeaed AST: Move SourceEntityWalker to IDE 2017-11-13 22:10:41 -08:00
Xi Ge
57fa43c9af [RangeInfo] Avoid analyzing implicit ASTNodes. rdar://31773556 (#9210) 2017-05-02 21:19:46 -07:00
Xi Ge
1ef97c0024 RangeInfo: Rework the criterion for valid selection of multiple statements, i.e. they should have a common brace statement as parent. (#8129) 2017-03-15 18:23:24 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Xi Ge
46eb3971f5 [RangeInfo] Some enrichment on reported range info. (#6475)
* [RangeInfo] Perform complete walk on the last node in a given range to avoid missing information due to early abort.

* [RangeInfo] For declared decls in a given range, report whether they are referenced outside of the range.

* [RangeInfo] Report the contained (topmost) ASTNodes inside a selected range.
2017-01-03 16:33:39 -08:00
Xi Ge
94851e25d7 [RangeInfo] Report the innermost decl context for the range under selection. (#6448) 2016-12-21 16:50:39 -08: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
Jordan Rose
91b72d3802 Fold the rest of PointerLikeTypeTraitsFwdDecl.h into TypeAlignments.h.
TypeAlignments.h predates this whole mess; it was used for types with
stronger alignment in PointerLikeTypeTraits than the old default of
"2 by fiat and assumption". All remaining forward-declared types are
AST types, so fold them into TypeAlignments.h.

(The one exception is SILTypeList.h, but that's already gone on master.)

To avoid future ODR issues, explicitly include TypeAlignments.h into
every header that defines a type it forward-declares.

I wish we could use partial specialization to provide PointerLikeTypeTraits
for all derived classes of Decl, TypeBase, etc, but that's not something
you can do in C++ if you don't control the traits class.
2016-02-06 11:22:28 -08:00
Jordan Rose
88ae300e26 Don't forward-declare PointerLikeTypeTraits for Clang types.
It may be an ODR violation, i.e. Clang may already have an instantiation of
the template in its own code.

rdar://problem/24284074
2016-02-06 11:22:28 -08:00
Chris Lattner
2af78aede1 forward declare ASTWalker in ASTNode.h instead of including its header, NFC. 2015-12-31 21:05:13 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Xi Ge
3088128501 Refactor DenseMapInfo<ASTNode> to ASTNode.h
Swift SVN r31438
2015-08-24 22:25:24 +00:00
Chris Lattner
9bbce68ec8 fix <rdar://problem/20894455> "variable was never mutated" diagnostic does not take #if into account
Swift SVN r28633
2015-05-15 18:30:32 +00:00
Justin Bogner
a49008298e InstrProf: Set up the basic infrastructure for profiling swift
This adds the -profile-generate flag, which enables LLVM's
instrumentation based profiling. It implements the instrumentation
for basic control flow, such as if statements, loops, and closures.

Swift SVN r25155
2015-02-11 01:06:18 +00:00
John McCall
2c239766a5 Declare the alignments of various AST types in their own
header so that we can freely form PointerIntPairs and
PointerUnions without worrying about header circularity.

Swift SVN r21694
2014-09-04 01:16:09 +00:00
Connor Wakamo
c7c15d68b8 Added missing newlines to the end of a few files.
Swift SVN r10791
2013-12-04 21:37:17 +00:00
Anna Zaks
54524e622a Replace ExprStmtOrDecl with ASTNode and make it a struct.
Previously, the Parser and BranchStmt typedef-ed ExprStmtOrDecl as a pointer union. Using typedef made the objects compatible, but did not allow us to extend the type with helper methods, such as getSourceRange(), which is something you can get on all of the AST objects. This patch introduces ASTNode that subclasses from PointerUnion and is used by both parser and BranchStmt.

Swift SVN r9971
2013-11-05 21:46:59 +00:00