Commit Graph

242 Commits

Author SHA1 Message Date
Ben Langmuir
fef998d7dc Fix a couple of 80-column violations in swift-ide-test NFC
and simplify some printing.
2016-03-08 20:39:45 -08:00
Ben Langmuir
f61a241dfc [ASTPrinter] Rename parameter callback to widen scope NFC
I want to start using this for other things like function types and
attributes, so rename it to reflect the new scope. I'm not really happy
with "PrintStructureKind", etc. but haven't come up with anything
better so far.
2016-03-03 18:39:20 -08:00
Ben Langmuir
65f0e7eb94 [SourceKit] Add annotation tags for generic type requirements
Each requirement gets tagged. We could also tag the whole where clause
if we need to, but so far it hasn't been interesting.

rdar://problem/24292226
2016-03-03 16:11:07 -08:00
Ben Langmuir
1182e41e01 [SourceKit] Add tags for generic parameters to annotated decl
Like typerefs, we want to show the USR in the tag.

rdar://problem/24292226
2016-03-03 12:47:09 -08:00
Ben Langmuir
1b22116639 [SourceKit] Refactor parameter printing to use its own callbacks NFC
The current approach of visiting the param decl won't work when we want
to visit the parameters of function *types*, or when visiting tuple
elements (which aren't themselves decls).

rdar://problem/24292226
2016-03-02 11:01:11 -08:00
Han Sangjin
f61e4b426d Use the method raw_ostream::resetColor instead of the escape code string
The Process::ResetColor() may return NULL if the LLVM library is built for Windows.
So, unguarded passing the return value to the raw_ostream may generate a crash.
The raw_ostream::resetColor() checks NULL and is used many time in the Clang.
2016-02-27 05:27:04 +09:00
Xi Ge
54d91c91da [test] Since group info is independent from doc comment table, strengthen the test to make sure every display decl from stdlib has an associated group name. 2016-02-24 21:05:27 -08:00
Doug Gregor
1c2ce6f22f [Omit needless words] Add a flag to let us skip overrides and witnesses.
When performing Swift API dumps, it's helpful to avoid putting
redundant APIs into the results. Therefore, filter out any APIs that
are overrides of another API or are witnesses for a protocol
requirement, since the original definition (that doesn't override any
other or is a protocol requirement) is what determines the APIs name.
2016-02-24 17:47:31 -08:00
Xi Ge
5270e62bb4 [test] swift-ide-test: Add a test to ensure that future stdlib public source files are properly grouped. 2016-02-24 16:21:26 -08:00
Erik Eckstein
dcb458676b Revert "Revert "[Omit needless words] Always dump both argument label and parameter name.""
This reverts commit 836cf9ea71.

Sorry, I reverted the wrong commit
2016-02-23 07:41:50 -08:00
Erik Eckstein
836cf9ea71 Revert "[Omit needless words] Always dump both argument label and parameter name."
This reverts commit c0b432d7eb.

There is a crash in StdlibUnittests on i386.
2016-02-22 21:30:41 -08:00
Doug Gregor
c0b432d7eb [Omit needless words] Always dump both argument label and parameter name.
The default first argument label rules are confusing reviewers looking
at API dumps. Even though it's more verbose, always put in argument
labels explicitly.
2016-02-22 15:11:16 -08:00
Xi Ge
1872214d40 Swif-ide-test: add a parameter to specify the group names to print. 2016-02-19 17:21:28 -08:00
Xi Ge
d4f704bb2f ASTPrinter: Add pre and post callbacks for printing synthesized extensions and call them.
This is necessary for jump to synthesized extensions in IDE.
2016-02-15 17:41:49 -08:00
Doug Gregor
9832468dac Install swift-api-dump.py script to make it easier to use 2016-02-15 11:38:00 -08:00
Ben Langmuir
e327378b24 [SourceKit] Add annotation tags for decl names
This splits the printDeclNamEndLoc callback into NameEndLoc and
NameOrSignatureEndLoc variants to differentiate whether or not
signatures are included.  All existing clients move to
NameOrSignatureEndLoc to maintain the current behaviour. I'm still not
completely happy with how these are named, but I dont' have any better
ideas right now.

rdar://problem/24292226
2016-02-12 15:57:28 -08:00
Jordan Rose
6272941c5c Rename "build configurations" to "conditional compilation blocks".
...because "build configuration" is already the name of an Xcode feature.

- '#if' et al are "conditional compilation directives".
- The condition is a "conditional compilation expression", or just
  "condition" if it's obvious.
- The predicates are "platform conditions" (including 'swift(>=...)')
- The options set with -D are "custom conditional compilation flags".
  (Thanks, Kevin!)

I left "IfConfigDecl" as is, as well as SourceKit's various "BuildConfig"
settings because some of them are part of the SourceKit request format.
We can change these in follow-up commits, or not.

rdar://problem/19812930
2016-02-12 11:09:26 -08:00
Xi Ge
7784ba959e ModulePrinter: allow module printer to print symbols from a specific group. 2016-02-09 11:49:16 -08:00
Doug Gregor
293d130272 [Omit needless words] Add a flag -enable-strip-ns-prefix to control NS stripping
Stripping "NS" is a massively invasive change; separate it out into
another flag.
2016-02-08 22:41:16 -08:00
Doug Gregor
1b149f9c05 [swift-ide-test] Add "-skip-print-doc-comments" option to suppress comments.
Use it in the omit-needless-words script, because the comments just
add noise to the diffs.
2016-02-04 20:44:04 -08:00
Xi Ge
ae60159816 [ModulePrint] Add the initial implementation for printing synthesized extensions.
For a concrete type, members from its conforming protocols' extensions can be hard
to manually surface. In this commit, when printing Swift modules, we start to replicate these
extensions and synthesize them as if they are the concrete type's native extensions.

Credit to Doug for suggesting this practice.
2016-02-02 14:53:21 -08:00
practicalswift
a3f857ca7b [gardening] Add "-*- C++ -*-" to header files currently missing it 2016-01-23 11:53:05 +01:00
practicalswift
33312eac6b [gardening] Remove unreachable/unused/redundant code
* Make parameter naming in forward declaration match definition
* Remove unused argument to function persistAsync(…)
* Remove unused enum ShouldHalt
* Remove unused enum class IsProtocol
* Remove unused function dumpTypeSubstitutionMap()
* Remove unused function template getFirstPairElt(…)
* Remove unused method addConstantWordInWords(…)
* Remove unused method asExistentialTI()
* Remove unused method currentTrackedState()
* Remove unused method getNumBodyParameters()
* Remove unused method getSuccIndex()
* Remove unused method getTypeOfDeclReference(…)
* Remove unused method hasStructWithAtMostOneNonTrivialField(…)
* Remove unused method initForDirectValues()
* Remove unused method nextIfNot(…)
* Remove unused method overwriteLoweredValue(…)
* Remove unused method removeColumn(…)
* Remove unused methods HasSingleDecl() and GetFirstDecl()
* Remove unused methods overwriteLoweredExplosion(…) and setLoweredSingleValue(…)
* Remove unused methods requireRetainablePointerValue(…), getMethodSelfInstanceType(…) and isSelfArchetype(…)
* Remove unused methods setAsEmptyDirect(), setAsSingleDirectUnmanagedFragileValue(…), setAsIndirectAddress(…) and getDirectValues()
* Remove unused struct CachedMemberInfo
* Remove unused struct CallEdit
* Remove unused struct ErrorImportInfo
* Remove unused synonym ConformancePair
* Remove unused variable SemaInfo
* Remove unused variable localDeclNameNode
* Remove unused variables kindToken and kindLoc
2016-01-22 09:43:24 +01:00
Doug Gregor
5e11e3f728 Also map -enable-omit-needless-words to a language option.
Although omit-needless-words is almost entirely a Clang importer task,
there are a handful of other places in the compiler that will need to
query this flag as well. NFC for now; those changes will come soon.
2016-01-17 23:40:14 -08:00
Doug Gregor
657319903e Add a "-swift3-migration" frontend option and corresponding language option.
This is intended to enable various Fix-Its to perform the one-way
migration from Swift 2.x to Swift 3, with a focus on the issues
involving naming.
2016-01-14 00:21:47 -08:00
Xi Ge
5a7a4f461d Port a util "getTypeFromMangledTypename" from lldb (lldb/source/Symbol/SwiftASTContext.cpp) to IDE and add some tests against it.
This utility helps us reconstruct type from a mangled name. SourceKit needs this functionality to deliver
richer doc-info/cursor-info.

Thanks for Sean's help!
2016-01-13 13:43:15 -08:00
Doug Gregor
d1707c02c1 Revert "Remove unnecessary 'visitDecl' default cases." 2016-01-11 21:07:21 -08:00
Doug Gregor
bef06570c7 Merge pull request #244 from mohammadg/dev
Remove unnecessary 'visitDecl' default cases.
2016-01-11 20:48:58 -08:00
John McCall
1f3b3142b4 Distinguish conformance and superclass generic requirements.
As part of this, use a different enum for parsed generic requirements.

NFC except that I noticed that ASTWalker wasn't visiting the second
type in a conformance constraint; fixing this seems to have no effect
beyond producing better IDE annotations.
2016-01-11 16:07:37 -08:00
practicalswift
c48a25647d Use correct formatting for separator line. 2016-01-05 09:49:00 +01:00
Xi Ge
c73bb636cd [SyntaxColoring] Teach syntax model to recognize playground-specific doc comment lines. rdar://23902920 2016-01-04 12:38:34 -08:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
practicalswift
dfcece7960 Use consistent style for comment separators. 2016-01-04 01:41:33 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Mayur Raiturkar
1158620439 Fixed Typos 2015-12-28 13:41:53 +05:30
Nadav Rotem
07d4558c1c [Mangler] Change the Swift mangler into a symbol builder.
This commit changes the Swift mangler from a utility that writes tokens into a
stream into a name-builder that has two phases: "building a name", and "ready".
This clear separation is needed for the implementation of the compression layer.

Users of the mangler can continue to build the name using the mangleXXX methods,
but to access the results the users of the mangler need to call the finalize()
method. This method can write the result into a stream, like before, or return
an std::string.
2015-12-25 21:40:25 -08:00
Nadav Rotem
8d4f777f83 [Mangler] Limit the lifetime of the Mangler
to make sure we are not accessing the buffer before the output is ready. The Mangler is going to be buffered (for compression), and accessing the underlying buffer is a bug.
2015-12-22 22:47:34 -08: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
Argyrios Kyrtzidis
6facd03f10 [IDE] Remove 'swift-ide-test -dump-api' which was superseded by 'swift-frontend -dump-api-path' functionality.
Also simplify the test to improve maintenance.
rdar://23903192.
2015-12-16 12:13:26 -08:00
Doug Gregor
563bdb9156 Clang importer: remove support for implicit properties.
We decided not to support "implicit" properties, where we import
getter/setter pairs as properties. Rather, we only import a property
when there is an explicit "@property" in Objective-C. Remove the flag
and supporting code for implicit properties.
2015-12-14 14:33:07 -08:00
Davide Italiano
2e78fdf58f Fix a bunch of pessimizing moves which prevent copy elision. 2015-12-11 19:09:13 +00:00
JP Simard
340b53fbbc remove unreachable code from swift-ide-test
there's a previous check for `ActionType::GenerateModuleAPIDescription`
which returns immediately, so this code is unreachable.
2015-12-09 23:47:47 -08:00
Mohammad Ghasembeigi
ee2ceca8d1 Remove unnecessary 'visitDecl' default cases.
The default cases are unnecessary and provide no benefits so they should
just be removed.
2015-12-06 03:08:08 +11:00
Doug Gregor
c41535a7fb Clang importer: start computing the effective lookup context with the name.
This places enumerators that will become either cases of a Swift enum
or options in a Swift option into the context of the C enum type for
the name lookup table.
2015-12-03 11:50:40 -08:00
Doug Gregor
c2bf16c0a9 Clang importer: start building a Swift name -> Clang declarations table.
When we parse a bridging header, start building a mapping from Swift
names (both base names and full names) to the Clang declarations that
have those names in particular Clang contexts. For now, just provide
the ability to build the table (barely) and dump it out; we'll grow
it's contents in time.
2015-12-03 11:50:39 -08:00
Argyrios Kyrtzidis
8659022917 [ASTPrint] For when printing interface from a source file, introduce an option to
pick up the original source text for the declarations.
2015-12-02 23:51:49 -08:00
Argyrios Kyrtzidis
04e3949985 [ASTPrint] Introduce a printing option to hide underscored protocols in the stdlib. 2015-12-02 22:38:34 -08:00
Xi Ge
9beeb56a90 [TypeInterface] When printing type-specific interfaces, replace parameter and return types with instantiated types. 2015-11-17 19:12:30 -08:00
Doug Gregor
9491ec4c02 Add a swift-ide-test option to not print import declarations.
The import declarations get in the way when looking the results of
-enable-omit-needless-words.
2015-11-16 15:27:38 -08:00