Commit Graph

53 Commits

Author SHA1 Message Date
Jordan Rose
1c651973c3 Excise "Accessibility" from the compiler (2/3)
"Accessibility" has a different meaning for app developers, so we've
already deliberately excised it from our diagnostics in favor of terms
like "access control" and "access level". Do the same in the compiler
now that we aren't constantly pulling things into the release branch.

This commit changes the 'Accessibility' enum to be named 'AccessLevel'.
2017-08-28 11:34:44 -07:00
Jordan Rose
5f30eac288 Excise "Accessibility" from the compiler (1/3)
"Accessibility" has a different meaning for app developers, so we've
already deliberately excised it from our diagnostics in favor of terms
like "access control" and "access level". Do the same in the compiler
now that we aren't constantly pulling things into the release branch.

This commit changes the names of methods, fields, a few local
variables, and even a swift-ide-test flag. The full list is below.

accessibilityForDiagnostics -> accessLevelForDiagnostics
checkAccessibility -> checkAccess
checkGenericParamAccessibility -> checkGenericParamAccess
checkTypeAccessibility -> checkTypeAccess
checkWitnessAccessibility -> checkWitnessAccessibility
computeAccessibility -> computeAccessLevel
computeDefaultAccessibility -> computeDefaultAccessLevel
fixItAccessibility -> fixItAccess
getAccessibilityString -> getAccessLevelString
getAccessibilityStrictly -> getAccessLevelStrictly
getAccessibilityUID -> getAccessLevelUID
getActualAccessibility -> getActualAccessLevel
getDefaultAccessibility -> getDefaultAccessLevel
getMaxAccessibility -> getMaxAccessLevel
getOverridableAccessibility -> getOverridableAccessLevel
getRawStableAccessibility -> getRawStableAccessLevel
getSetterAccessibility -> getSetterFormalAccess
hasAccessibility -> hasAccess
hasDefaultAccessibility -> hasDefaultAccessLevel
inferAccessibility -> inferAccessLevel
inferDefaultAccessibility -> inferDefaultAccessLevel
inferSetterAccessibility -> inferSetterAccessLevel
overwriteAccessibility -> overwriteAccess
overwriteSetterAccessibility -> overwriteSetterAccess
printAccessibility -> printAccess
requiredAccessibilityForDiagnostics -> requiredAccessForDiagnostics
resolveAccessibility -> resolveAccessControl
setAccessibility -> setAccess
setSetterAccessibility -> setSetterAccess
setDefaultAndMaxAccessibility -> setDefaultAndMaxAccess
validateAccessibility -> validateAccessControl

Accessibility -> AccessLevel
AccessibilityFilter -> AccessFilter
IgnoreAccessibility -> IgnoreAccessControl
NL_IgnoreAccessibility -> NL_IgnoreAccessControl
PrintAccessibility -> PrintAccess
PrintInternalAccessibilityKeyword -> PrintInternalAccessKeyword
SetterAccessibility -> SetterAccessLevel

setterAccessibility -> setterAccess
storedPropertyAccessibility -> storedPropertyAccess

-print-accessibility -> -print-access
2017-08-28 11:11:57 -07:00
David Farler
2c04dfd7f6 [Markup] Actually collect multiple - Tag fields
This was erasing the set of tags each time a - Tag simple field
was encountered.

rdar://problem/32877771
2017-07-05 22:36:16 -07:00
David Farler
a85e1d6f30 [Markup] Print Tags in documentation comment XML
This information needs to be picked up through SourceKit. It might be
useful as both metadata for sorting/filtering as well as presentation,
so it makes sense to print it in the normal XML inside CommentParts.

rdar://problem/32877771
2017-06-22 16:45:22 -07:00
Jordan Rose
129fd372d5 ASTPrinter: Qualify names when printing nested declarations.
That is, if you have this declaration:

    struct Outer {
      struct Inner {
        // ...
      }
    }

and you're just printing 'Inner', print it like this:

    struct Outer.Inner {
      // ...
    }

This comes up with the ClangImporter's import-as-member feature, and
is also about to affect how error code enums are imported as well.

This is currently only enabled in certain contexts: always when
printing interfaces, and for types (but not other members) when
printing declarations for Quick Help.

rdar://problem/28208090
2017-04-24 09:57:40 -07:00
Maxwell Swadling
452e535ba4 Updated quick help XML to separate the comment data from the metadata 2017-04-17 14:53:57 -07:00
swift-ci
60e54b9e53 Merge pull request #8131 from akyrtzi/img-tag-in-doc-comment 2017-03-15 17:21:07 -07:00
Argyrios Kyrtzidis
fa4b6095e1 [IDE] Use proper slash for closing an <img> tag in documentation comment XML.
rdar://24314778
2017-03-15 16:27:05 -07:00
Xi Ge
0e1cc083b5 DocComment API: ensure LineList does not outlive the MarkupContext and SourceManager it depends on. (#8102) 2017-03-15 00:05:56 -07:00
Xi Ge
0d97dd4992 [SourceKit] Add a new request to translate markup text to its XML equivalence. rdar://30587403 (#8088)
Required fields:
- "key.request": "source.request.convert.markup.xml"
- "key.sourcetext": "markup text"

Expected response:
- "key.sourcetext": "xml text"
2017-03-14 15:13:43 -07:00
David Farler
677e03df85 [SourceKit] Vend the localization key found in documentation comments
If a documentation comment has a - LocalizationKey: field, strip it
out of the documentation body and report it in cursor/doc info with
the key "key.localization_key".

rdar://problem/30383329
2017-02-17 17:54:15 -08:00
Daniel Martín
d510793566 Fix SR-2860 2017-01-16 09:39:36 +01:00
Christopher Rogers
a33aed0180 [PrintAsObjC] Inline code segments in documentation should remain inline. (#6625)
Fixes <https://bugs.swift.org/browse/SR-3163>.
2017-01-06 17:21:59 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
38be6125e5 [gardening] C++ gardening: Terminate namespaces, fix argument names, ...
Changes:
* Terminate all namespaces with the correct closing comment.
* Make sure argument names in comments match the corresponding parameter name.
* Remove redundant get() calls on smart pointers.
* Prefer using "override" or "final" instead of "virtual". Remove "virtual" where appropriate.
2016-12-17 00:32:42 +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
f450f0ccdf Revert "Preserve whitespace and comments during lexing as Trivia"
This reverts commit d6e2b58382.
2016-11-18 13:23:31 -08:00
David Farler
d6e2b58382 Preserve whitespace and comments during lexing as Trivia
Store leading a trailing "trivia" around a token, such as whitespace,
comments, doc comments, and escaping backticks. These are syntactically
important for preserving formatting when printing ASTs but don't
semantically affect the program.

Tokens take all trailing trivia up to, but not including, the next
newline. This is important to maintain checks that statements without
semicolon separators start on a new line, among other things.

Trivia are now data attached to the ends of tokens, not tokens
themselves.

Create a new Syntax sublibrary for upcoming immutable, persistent,
thread-safe ASTs, which will contain only the syntactic information
about source structure, as well as for generating new source code, and
structural editing. Proactively move swift::Token into there.

Since this patch is getting a bit large, a token fuzzer which checks
for round-trip equivlence with the workflow:

fuzzer => token stream => file1
  => Lexer => token stream => file 2 => diff(file1, file2)

Will arrive in a subsequent commit.

This patch does not change the grammar.
2016-11-15 16:11:57 -08:00
David Farler
c9f5504797 Cascading Doc Comments: Look up class hierarchy when doc comments are missing
If a class member doesn't have a doc comment but a base class does, show
the base class's comment and add a note about where it came from.

rdar://problem/16512247
2016-06-27 11:55:31 -07:00
David Farler
4d8b33e5ba Markup: Move Doxygen converter into a proper MarkupASTNode visitor
Enclose the entire doc comment in /** */ to ensure that newlines
don't cause comments to leak out and get parsed as C.

rdar://problem/24923076
2016-05-03 16:44:31 -07:00
practicalswift
ba5de12177 [gardening] Fix recently introduced typo: "an swift" → "a swift" 2016-04-11 11:56:30 +02:00
David Farler
a6b410bcb1 Add rudimentary nested closure param/return/throws support for Doxygen
There isn't a great nested argument feature that we can use in our
Doxygen emitter but we can approximate it by nesting unordered lists
with labels.

rdar://problem/24794725
2016-04-10 17:14:56 -07:00
David Farler
c20f3db09e Nesting parameter/returns/throws doc comments for closure parameters
Under parameter doc comment list items, allow function doc comment
syntax to nest so you can document the meaning of closure parameters'
signatures.

rdar://problem/24794725
2016-04-10 15:32:07 -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
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00: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
David Farler
4704a5f2bc Escape <Link> tags in doc comment XML
URLs come through SourceKit as custom <Link> elements which weren't
getting escaped as raw HTML, which would cause URLs with query
strings to get cut off because of ampersands.

rdar://problem/23394719
2015-11-09 01:38:39 -08: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
Xi Ge
61c1e99304 [IDE] Expose an API to extract plain text from given comments. rdar://22021120
Swift SVN r30834
2015-07-31 01:36:53 +00:00
Xi Ge
6471303c12 [InterfacePrinting] Alter PrintOptions for interface printing so that user-defined internal decls are visible in the generated interfaces.
Also, we always print accessibility keywords in the printed interfaces, so that users can differentiate public and
internal decls.
rdar://20680375

Swift SVN r30520
2015-07-23 01:37:20 +00:00
Xi Ge
09c1d8f308 [DocCommentPrint] For quick help, print objc declarations in Swift. rdar://21097812
Swift SVN r29949
2015-07-08 00:05:52 +00:00
David Farler
dd44dad017 Add 'throws' keyword to doc comments
Adding the following to a doc comment:

- throws: ...

Will create a description about what/when the function will throw.
This should be a peer to "- returns:" and "- parameter:" and not appear
inline in the description.

rdar://problem/21621679

Swift SVN r29831
2015-07-01 02:03:25 +00:00
Xi Ge
04e01973d2 Address Argyrios' comments; use interface print option when printing document comment.
Swift SVN r29314
2015-06-05 01:33:57 +00:00
Xi Ge
768b4c7f0e [DocCommentPrint] avoid printing private standard lib decls. rdar://20858548
Swift SVN r29313
2015-06-05 00:20:30 +00:00
David Farler
09b486dbcd ObjC Header missing comment markers for some newline cases
Printing Doxygen isn't inside an XML tag, so we can't just print
code block content, which may have new lines without a doc comment
marker. Also, be more robust with indentation.

+ Tests.

rdar://problem/20703026

Swift SVN r27851
2015-04-28 01:32:54 +00:00
David Farler
0ee38ba4aa ASan build fix: overlapping memcpy and compiler flags in swift-ide-test
- Pass EnableObjCAttrRequiresFoundation to CompilerInvocation in
  swift-ide-test when printing comments.
- Use separate streams for printing HTML <h> tags

Swift SVN r27771
2015-04-26 20:02:00 +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
Argyrios Kyrtzidis
b9ad28550e [IDE] When getting documentation comments XML, don't forget to escape the decl name as well.
rdar://20646650

Swift SVN r27580
2015-04-22 17:02:33 +00:00
Dave Abrahams
4411b01732 ReST hacks: "handle" backslash-space
Backslash+space acts like a token-breaking non-breaking-space in ReST

Swift SVN r25460
2015-02-21 04:35:48 +00:00
Dave Abrahams
1bc5f0eb29 ReST hacks: "handle" code blocks
This is at the expense of blockquotes, which we don't actually need at
the moment.  All blockquotes get interpreted as preformatted code.

Swift SVN r25459
2015-02-21 04:02:54 +00:00
Dmitri Hrybenko
e9f06eee68 Comment parsing: implement basic parsing of inline markup
This change adds infrastructure to represent inline markup in the AST,
implements parsing of some of the inline markup (*emphasis*, **strong
emphasis**, `interpreted text`, ``inline literal``), and XML generation
for these constructs for SourceKit clients to consume.

The parsing itself is incomplete for constructs not mentioned above.
Most notably, we don't parse hyperlinks, and we don't parse the
double-colon that changes the next paragraph into a literal block.

Swift SVN r22752
2014-10-15 13:50:48 +00:00
Dmitri Hrybenko
45963a413e Revert "comment parsing wip"
Revert something I committed accidentally.

Swift SVN r22699
2014-10-13 14:48:07 +00:00
Dmitri Hrybenko
3dac00f60f comment parsing wip
comment parsing: more wip

comment parsing: more wip

comment parsing: even more wip

Swift SVN r22697
2014-10-13 14:27:22 +00:00
Sonny Falk
f7b883f6dd [IDE] Make sure to XML-escape the pretty printed declaration in Comment to XML conversion.
Update test accordingly. Additional regression test added on SourceKit side.

This addresses <rdar://problem/17239097>.

Swift SVN r20343
2014-07-22 22:36:49 +00:00
Jordan Rose
574054b8fd Distance SourceManager from llvm::SourceMgr.
...in preparation for non-source locations, i.e. locations that don't come
frome source buffers.

No functionality change, but a fair bit of SourceManager API and idioms have
changed.

Swift SVN r18942
2014-06-17 01:15:47 +00:00
Ted Kremenek
0b2c23ffec Remove special printing of ImplicitlyUnwrappedOptional<T>.
Part of <rdar://problem/16836463>

Swift SVN r17610
2014-05-07 06:59:52 +00:00
Ted Kremenek
050fd53af7 Rename UncheckedOptional to ImplicitlyUnwrappedOptional.
Swift SVN r17232
2014-05-02 06:13:57 +00:00
Dmitri Hrybenko
c4ef6bd032 Comment to XML conversion: adjust to upstream XML schema change
Swift SVN r17148
2014-05-01 08:51:32 +00:00
Dmitri Hrybenko
00722d4c2e Comment parsing: extract parameter name from the text in :param: field
Swift SVN r16750
2014-04-24 09:13:42 +00:00
Dmitri Hrybenko
cfb3d287de Comment to XML conversion: add pretty-printed declaration
Swift SVN r16698
2014-04-23 11:57:12 +00:00