Commit Graph

4104 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis
44d46de7c9 Use swift::SourceManager's addNewSourceBuffer() instead of llvm::SourceMgr's AddNewSourceBuffer().
Also remove the SourceLoc parameter from addNewSourceBuffer(). In llvm::SourceMgr
it is used to indicate textual inclusion, which we don't have in swift.

Swift SVN r10014
2013-11-07 00:51:56 +00:00
Joe Groff
16c5d69e17 ClangImporter: Recognize NS_ENUM declarations and import as Swift enums.
When we see an enum declaration in the Clang importer, look at its source location to see if it was produced as part of an NS_ENUM macro expansion. If so, take the 'Enum' route through the Clang importer and import it as a Swift enum. This will break things until we have end-to-end support for Clang-imported enums, so hide it behind an -import-ns-enum switch for now.

Swift SVN r9951
2013-11-05 01:38:00 +00:00
Joe Groff
1616276923 SILGen: Remove 'SILGenLValuePeepholes' flag.
r9931 fixes the crashes this exposes, so we can enable it by default now.

Swift SVN r9935
2013-11-04 22:54:54 +00:00
Chris Lattner
68af974227 Remove 'axle' related code and build machinery. It turns out that we
will not be pursuing this project in the immediate future.



Swift SVN r9901
2013-11-03 16:04:27 +00:00
Dmitri Hrybenko
b4ef9f4610 Clarify the difference between swift::IsTriviallyCopyable and llvm::isPodLike
Swift SVN r9730
2013-10-28 21:31:11 +00:00
Dmitri Hrybenko
b62e8903de Portability: libstdc++ does not implement is_trivially_copyable yet, implement
our own wrapper


Swift SVN r9695
2013-10-27 05:52:22 +00:00
Adrian Prantl
15f2b7c51f Ocaml _did_ beat us today. Next up: C++14.
Swift SVN r9685
2013-10-26 00:12:14 +00:00
Enrico Granata
6e666c7c22 <rdar://problem/15321132>
Demangle nominal type descriptor _TMn correctly



Swift SVN r9675
2013-10-25 18:02:46 +00:00
Argyrios Kyrtzidis
bb068725b4 [libBasic] Add documentation comments for ThreadSafeRefCounted.h
Swift SVN r9654
2013-10-24 21:33:22 +00:00
Argyrios Kyrtzidis
60edb9683d [libBasic] Introduce a thread-safe version of llvm::RefCountedBase.
This is to be used by the code-completion infrastructure while managing its global caches.

Swift SVN r9652
2013-10-24 20:34:32 +00:00
Argyrios Kyrtzidis
ec570d7fac [libBasic] Dmitri caught that always static_casting the key to check for equality will break if the rest of
the cache traits do not provide a direct pointer to the key object.

Swift SVN r9651
2013-10-24 20:25:00 +00:00
Argyrios Kyrtzidis
49a5f53e19 [libBasic] Introduce a caching mechanism, that evicts its entries when there is memory pressure.
The underlying mechanism uses darwin's libcache library (if not building on darwin there is a default implementation).

This was originally introduced in SourceKit, but we are moving it to libswiftBasic so it can be utilized by libswiftIDE
for caching code-completion results.

Swift SVN r9610
2013-10-23 00:41:55 +00:00
Sonny Falk
df693fd744 Make the CharSourceRange constructor take the SourceManager parameter as const.
Swift SVN r9596
2013-10-22 20:48:15 +00:00
Enrico Granata
ef9a1b32d4 <rdar://problem/15213551>
This checkin extends the Demangler to allow printing sugar on demangled types
Namely, it introduces a DemanglerOptions class with just one field SynthesizeSugarOnTypes which has the same functionality as PrintOptions::SynthesizeSugarOnTypes
This changes outputs like _TtGSqC5sugar7MyClass_ ---> swift.Optional<sugar.MyClass> into _TtGSqC5sugar7MyClass_ ---> sugar.MyClass?

By default this flag is false, so that existing clients of the Demangler API do not break

OTOH, the command-line tool swift-demangle flags sets the flag to true, unless the -no-sugar option is passed on the command-line

Test cases included



Swift SVN r9502
2013-10-18 22:05:08 +00:00
Adrian Prantl
03db2c6461 Add a reminder to check the namespace for language constants later.
Swift SVN r9413
2013-10-16 16:40:25 +00:00
Joe Groff
cd74f49434 Revert "SILGen: Enable lvalue-to-lvalue copy_addr initialization peephole by default."
This reverts commit r9347. The copy_addr peephole still crashes the
Demo-2012-07/uniq.swift test on the buildbot.

Swift SVN r9358
2013-10-15 18:18:29 +00:00
Joe Groff
47dd733c3f SILGen: Enable lvalue-to-lvalue copy_addr initialization peephole by default.
The Interpreter crashes this introduced in the end-to-end pipeline seem to have subsided, now that DI is prepared for it.

Swift SVN r9349
2013-10-15 16:56:15 +00:00
John McCall
af1aa962de Make ArrayRefView::iterator conform to the random-access
iterator requirements.

Swift SVN r9089
2013-10-09 20:55:44 +00:00
Joe Groff
2ffd735255 SILGen: Peephole lvalue-to-lvalue initializations as copy_addrs.
If we're using emitExprInto to emit a LoadExpr, we can handle that by emitting a copy_addr from the underlying lvalue to the initialization instead of building and storing the rvalue, which plays better with the direction we're taking for value semantics optimizations.

This is currently guarded behind a flag -enable-silgen-lvalue-peepholes because it introduces a miscompile in the stdlib that crashes some tests; requires further investigation before making live.

Swift SVN r9027
2013-10-08 20:44:09 +00:00
John Garvin
4a8ac0d752 Parse kernel, vertex, and fragment function attributes. Metadata is not yet being generated.
This is part of <rdar://problem/14951602> AGP5 bring up: Parse AGP5 kernel function attributes.



Swift SVN r8670
2013-09-25 22:16:57 +00:00
Joe Groff
3d4c1251f1 Rename 'byref' attribute to 'inout'.
Swift SVN r8661
2013-09-25 20:56:52 +00:00
Argyrios Kyrtzidis
9e0cfb811d [AST] Allow the mangler to handle declarations with error types in them.
This is only useful for unique-identification uses of the mangler, like in SourceKit,
which has to deal with invalid code.
Since this is not related to ABI, we can change the encoding anytime we want.

Swift SVN r8557
2013-09-23 16:11:26 +00:00
Joe Groff
e109124186 Replace 'union' keyword with 'enum'.
This only touches the compiler and tests. Doc updates to follow.

Swift SVN r8478
2013-09-20 01:33:14 +00:00
John McCall
cb06e316d0 Add CanBoundGenericType::getGenericArgs().
Swift SVN r8329
2013-09-17 07:22:26 +00:00
Argyrios Kyrtzidis
5db368ce7b [Lexer] Introduce Lexer::getLocForStartOfToken() that returns the location at the start of the token that a given offset points to.
Swift SVN r8281
2013-09-16 18:41:16 +00:00
Joe Groff
6dbc1a8835 Add manglings for associated types.
This should allow declarations inside protocols to mangle successfully, which is needed by SourceKit to be able to use mangled names as unique decl identifiers. I'm also planning to use mangled protocol decls to name generic curry thunk symbols.

This only introduces a mangling for independent associated types. I think we will eventually want to mangle dependent associated types (such as T.AssocType for an archetype T : SomeProtocol) with a non-indexed mangling too, but this doesn't do that yet.

Swift SVN r8148
2013-09-12 15:29:08 +00:00
Enrico Granata
b3576d8599 Replacing the GenericTypeApplication node with more specific BoundGeneric{Class|Structure|Union} nodes
Removing the TypeList node underneath a TypeList, a TypeList just needs to wrap a list of Type nodes



Swift SVN r7990
2013-09-06 17:47:06 +00:00
Enrico Granata
80278dfedc Simplifying the demangling for UncurriedFunctionType objects, from:
k = UncurriedFunctionType
  k = UncurriedFunctionMetaType
    k = Type
      k = MetaType

to:
k = UncurriedFunctionType
  k = MetaType

This should help Greg parse uncurried functions with greater ease



Swift SVN r7964
2013-09-05 23:09:10 +00:00
Chris Lattner
dea8213ef9 remove the -enable-definite-init command line option. Definite init
seems to have stuck.


Swift SVN r7956
2013-09-05 20:37:41 +00:00
Adrian Prantl
07da340eef Move Dwarf constant definitions from lib/IrGen to include/basic.
Swift SVN r7850
2013-09-03 18:09:51 +00:00
Enrico Granata
389c867551 Making the Demangler work properly with nested types, in the sense that Paths that represent nested types need to come out flat instead of hierarchical
Adding a couple test cases for this



Swift SVN r7724
2013-08-29 18:20:09 +00:00
Enrico Granata
72112bf575 More demangler changes - these introduce a new structure to the demangling that is better suited to Greg\'s need to produce types and decls out of demangled trees
Swift SVN r7714
2013-08-29 01:52:58 +00:00
Enrico Granata
a199242321 Sending 7641 again + a fix for the inf loop that Dmitri found
I also added that one as a test case



Swift SVN r7656
2013-08-28 01:02:01 +00:00
Dmitri Hrybenko
6eb5bc58d2 Revert r7641. It causes an infloop while demangling a name in test/SILGen/class_bound_protocols.swift
Swift SVN r7647
2013-08-27 23:36:35 +00:00
Enrico Granata
ff3ea6e3ce <rdar://problem/14830080> & <rdar://problem/14822344>
The previous implementation of the tree structure for the demangler had a bug in the low-level tree management code which caused the tree structure to diverge depending on whether
nodes were added as siblings or children. This checkin fixes the issue by making sure that the tree of nodes is kept coherent at all times.
Some adjustments are necessary to ensure the nodes were still generated properly and correctly turned into strings
Added a new test case



Swift SVN r7643
2013-08-27 22:56:48 +00:00
Enrico Granata
f2ba4c8c59 This commit changes the way the Demangler handles substitutions
Previously, substitutions were treated as unstructured text chunks, but this was causing problems when using the demangler as a source of structured type information
This patch ensures that substitutions are properly stored as the type they represent for later semantic reconstruction



Swift SVN r7494
2013-08-23 00:21:26 +00:00
Enrico Granata
687b142101 Undoing the damage of clang-format + first round of demangler cleanup
Swift SVN r7342
2013-08-19 23:15:51 +00:00
Chris Lattner
8d1f71deb1 demangle some of the demangler source code.
Swift SVN r7335
2013-08-19 22:37:53 +00:00
Enrico Granata
2d97d22d33 clang-formatted the Demangler
Swift SVN r7334
2013-08-19 22:34:30 +00:00
Enrico Granata
47d1a137b5 Major demangler changes.
This commit changes the Swift demangler to produce a tree-like list of tokens instead of a string.
This is mostly useful for LLDB since we can use the inherent structure in a Swift mangled name to make more informed decisions about matters such as type information extraction from modules
The ability to convert the tokenized output into a plain string for viewing purposes is of course preserved



Swift SVN r7297
2013-08-16 22:30:58 +00:00
Chris Lattner
23f657f5c9 make Fixnum more comparable
Swift SVN r7296
2013-08-16 22:30:18 +00:00
Argyrios Kyrtzidis
0d7fc0aa1d [ide] Use the newly introduce CharSourceRange inside ide::SyntaxNode.
Swift SVN r7174
2013-08-12 20:58:20 +00:00
Dmitri Hrybenko
70f2b64ad9 Add CharSourceRange -- a half-open character range, which will be used in IDE
integration

Motivation: libIDE clients should be simple, and they should not have to
translate token-based SourceRanges to character locations.

This also allows us to remove the dependency of DiagnosticConsumer on the
Lexer.  Now the DiagnosticEngine translates the diagnostics to CharSourceRanges
and passes character-based ranges to the DiagnosticConsumer.


Swift SVN r7173
2013-08-12 20:15:51 +00:00
Chris Lattner
1332be7ede add a new "-enable-definite-init" command line option that will gate the
new definitive initialization work until it is ready to be on by default.
This needs to be a langoption as well, because it will affect some of the
things SILGen does.


Swift SVN r7135
2013-08-10 20:30: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
Dmitri Hrybenko
efd688dcd9 Now findBufferContainingLoc() can not fail, so store Buffer IDs in unsigned
variables.


Swift SVN r7121
2013-08-10 02:12:59 +00:00
Dmitri Hrybenko
13070a31bd SourceManager: make findBufferContainingLoc() always succeed.
Every valid source location corresponds to a source buffer.  There should be no
cases where we create a source location for a random string.  Thus,
findBufferContainingLoc() always succeeds.


Swift SVN r7120
2013-08-10 01:48:04 +00:00
Dmitri Hrybenko
9c57f8454c Do the final cleanups and make SourceLoc::Value private
Swift SVN r7115
2013-08-09 23:52:01 +00:00
Dmitri Hrybenko
8f7a437d44 Wrap a few functions from LLVM SourceMgr in preparation of making
SourceLoc::Value private


Swift SVN r7114
2013-08-09 23:15:59 +00:00
Dmitri Hrybenko
aacef757ed Move decompose from PrettyStackTrace.cpp to the SourceManager
It requires direct access to the SourceLoc internals and is generally useful
anyway.


Swift SVN r7111
2013-08-09 22:50:58 +00:00