Commit Graph

25 Commits

Author SHA1 Message Date
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
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
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
Victoria Mitchell
0639a9e2fb review: rename Attribute to InlineAttributes 2022-07-21 17:22:41 -06:00
Victoria Mitchell
76fe621c1f markup: add support for swift-cmark inline attributes
rdar://96830173
2022-07-21 08:13:07 -06:00
Victoria Mitchell
57475013c9 use newer cmark node kind names
the older names were kept in the cmark header for compatibility, but
these are the ones that are actually defined in the main enum
2022-07-21 08:13:06 -06:00
Victoria Mitchell
455cdbc5a7 use swift-cmark/gfm instead of /main 2022-03-16 14:56:21 -06:00
Owen Voorhees
d68089dcf9 [Diagnostics] Add a basic terminal markdown printer for educational notes
Currently the printer only supports the subset of markdown used by
educational notes. It bolds headers, improves the appearance of lists
and horizontal rules, and does basic indenting of blockquotes and
code blocks.
2020-03-05 18:04:32 -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
David Farler
abed7b67d6 Merge pull request #2132 from bitjammer/closure-param-doc
Add nested parameter/returns/throws comment recognition
2016-04-10 17:06:51 -07:00
David Farler
a9297eed9f Rename llvm::markup namespace to swift::markup
This was naming was cargoed from long ago and this functionality isn't
directly related to LLVM, it's specific to Swift.
2016-04-10 13:46:25 -07:00
David Farler
fbc220a036 Revert "Revert "Enable cmark smart punctuation in doc comments""
This reverts commit f723b86614 and
updates the IDE tests that incidentally included some punctuation.
No new tests are necessary - the character level tests are exercised
in cmark itself.
2016-04-10 13:32:43 -07:00
Ted Kremenek
f723b86614 Revert "Enable cmark smart punctuation in doc comments"
This reverts commit 3f0376116c.

This broke the Linux build.
2016-04-10 13:03:12 -07:00
David Farler
3f0376116c Enable cmark smart punctuation in doc comments
The following unescaped sequences will be rendered with cmark's "smart
punctuation" rules, roughly:

- Closed pairs of single/double straight quotes -> curly quotes
- Double dash: en-dash
- Triple dash: em-dash
- Three periods -> ellipsis character

rdar://problem/24794606
2016-04-10 12:42:52 -07:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
cd7d8dfaff Fix alignment as requested by @gribozavr in #692 2015-12-21 08:54:24 +01:00
practicalswift
176f487d76 Fix incorrect filenames in headers. 2015-12-20 23:59:05 +01:00
David Farler
e87be804c9 [Markup] Slurp fenced code block info string
Add a language property for Markup code blocks - the default is
"swift" but will respect overrides such as the following:

```c++
Something::Somethign::create()
```

For code listings in doc comments written in other languages, such
as when you want to compare usage against another language.

rdar://problem/23948115
2015-12-17 17:51:27 -08:00
Nick Wellnhofer
e02ca76275 Don't rely on cmark internals
The cmark_node struct and the node.h header are private.
2015-12-04 23:11:47 +01:00
Ben Langmuir
8d656dec8b Fix small leaks in markup parser
These were all seen during code completion while parsing the doc
comments.

* We missed freeing a cmark iterator
* Image and Link stored a std::string inside a BumpPtrAllocator

rdar://problem/22387897

Swift SVN r31560
2015-08-28 20:37:23 +00:00
David Farler
62d6c3a912 Add alt/title tags to rendered markup images
These elements were getting parsed but dropped on the floor.
Now, they'll be added to the Swift Markup AST if they are
present and emitted in the HTML.

rdar://problem/22369731

Swift SVN r31452
2015-08-25 21:16:13 +00:00
Nadav Rotem
f345ca33fd Fix unused variable warnings in Release builds.
Swift SVN r29367
2015-06-12 18:27:26 +00:00
David Farler
ca5876a866 swiftMarkup Library
Replace ReST-flavored documentation comments with Markdown.

rdar://problem/20180412

In addition to full Markdown support, the following extensions are
supported. These appear as lists at the top level of the comment's
"document". All of these extensions are matched without regard to
case.

Parameter Outlines
------------------

- Parameters:
  - x: ...
  - y: ...

Separate Parameters
-------------------

- parameter x: ...
- parameter y: ...

- Note:
Parameter documentation may be broken up across the entire comment,
with a mix of parameter documentation kinds - they'll be consolidated
in the end.

Returns
-------

- returns: ...

The following extensions are also list items at the top level, which
will also appear in Xcode QuickHelp as first-class citizens:

- Attention: ...
- Author: ...
- Authors: ...
- Bug: ...
- Complexity: ...
- Copyright: ...
- Date: ...
- Experiment: ...
- Important: ...
- Invariant: ...
- Note: ...
- Postcondition: ...
- Precondition: ...
- Remark: ...
- Remarks: ...
- See: ...
- Since: ...
- Todo: ...
- Version: ...
- Warning: ...

These match most of the extra fields in Doxygen, plus a few more per request.

Other changes
-------------
- Remove use of rawHTML for all markup AST nodes except for those
not representable by the Xcode QuickHelp XSLT - <h>, <hr/>, and of
course inline/block HTML itself.

- Update the doc comment RNG schema to more accurately reflect Xcode
QuickHelp.

- Clean up cmark CMake configuration.

- Rename "FullComment" to "DocComment"

- Update the Swift Standard Documentation (in a follow-up commit)

- Update SourceKit for minor changes and link against cmark
  (in a follow-up commit).

Swift SVN r27727
2015-04-26 00:07:15 +00:00