Commit Graph

2357 Commits

Author SHA1 Message Date
Chris Lattner
4f8040845e improve a comment.
Swift SVN r1180
2012-03-11 04:56:59 +00:00
Chris Lattner
9e873372d9 move attributes out to their own .def file, to match expr's and stmt's.
Part of rdar://10719165 - Clean up attributes code


Swift SVN r1179
2012-03-11 01:39:11 +00:00
Eli Friedman
ddffb633eb Fix build errors with clang-421.
Swift SVN r1167
2012-03-05 19:31:12 +00:00
Chris Lattner
58b4a5d7cc have the parser produce ErrorStmt nodes to handle semantic errors...
except that it never produces semantic errors.  How about that.


Swift SVN r1143
2012-03-01 22:54:41 +00:00
Chris Lattner
1076367d73 implement rdar://10962528 - split up the int/fp literal lexing and grammar.
This cleans up handling of int/fp literals by splitting them appart at the
lexer level.


Swift SVN r1137
2012-03-01 19:06:55 +00:00
Chris Lattner
17ea0a6670 finish my pass over LangRef, updating it and changing it and the parser to keep the grammars in sync.
Swift SVN r1132
2012-03-01 16:55:09 +00:00
Chris Lattner
ee89183c13 attribute-list is nullable, so it doesn't need to be optional, this matches lang-ref.
Swift SVN r1129
2012-02-26 19:01:15 +00:00
Chris Lattner
ee0f2bb436 var names cannot be operators. We already diagnosed this at sema time, but
it's better to catch it earlier to make the grammar more clear.


Swift SVN r1128
2012-02-26 18:55:03 +00:00
Chris Lattner
cd29a77770 introduce a new parseIdentifier method that *just* parses identifiers,
but not operators.  Audit calls to make sure that we use the right one
in the right places.  This allows us to reject structs named * for example.


Swift SVN r1127
2012-02-26 18:20:58 +00:00
Chris Lattner
dd0c5aff52 Rename parseIdentifier to parseAnyIdentifier to match langref and
make it clear to it also allows operators.


Swift SVN r1126
2012-02-26 18:16:30 +00:00
John McCall
00b97b38af Grab-bag of materialization-related changes:
- introduce the concept of qualifiers on l-value types
  - teach overload resolution and coercion how to drop explicitness
  - require explicitness on normal [byref] arguments
  - make 'this' [byref(implicit)]
  - special-case '&' as a unary operator in the parser to make it
    produce an expression which type-checks as turning implicit l-values
    into explicit ones.

Obvious missing pieces:
  - updating LangRef
  - we should really complain about ever trying to rvalue-convert an
    explicit l-value
  - maybe qualification should play a part in overload resolution
  - we should diagnose attempts to declare unary '&' operators
  - there's a test case in expressions.swift which suggests my logic is
    slightly off

But I am out of time, and these will have to wait.

Swift SVN r1119
2012-02-22 06:43:33 +00:00
John McCall
2b65cf22d1 Make 'this' implicitly [byref] when the container type does
not have reference semantics.  Deciding whether the container
type has reference semantics requires us to perform
some amount of limited name-binding and type-checking first,
which introduces a few complexities.

Also, fix a bug in uncurried call emission.

Methods work now.



Swift SVN r1112
2012-02-11 07:37:57 +00:00
John McCall
7b29a420f6 Design and implement the [byref] attribute, checking that
it doesn't appear in places it shouldn't.  The only limits on
this checking right now is the inadequacy of location information
for types, which is something we ought to fix.

Fix type-checking of byref applications.  Fix IR generation
of byref variables.  Whole lotta fixin' goin' on.

But hey, byref calls work.



Swift SVN r1111
2012-02-10 09:42:50 +00:00
John McCall
ce7780af04 I don't think we're really getting anything out of ArgDecl
at the moment.  We can put it back if I'm wrong.



Swift SVN r1100
2012-01-26 02:08:52 +00:00
John McCall
16f8b2e656 Revise the language design for function argument clause syntax.
A function argument clause is now one or more patterns (which
must be parenthesized and explicitly type all positions) not
separated by arrows;  the first arrow then separates off the
return type.

Revisions to language reference forthcoming.



Swift SVN r1099
2012-01-26 01:25:26 +00:00
Chris Lattner
599e4b2528 switch to using the new llvm::MutableArrayRef class, this requires llvm r148463
Swift SVN r1088
2012-01-19 06:39:07 +00:00
Chris Lattner
594c117658 remove a dead diagnostic, simplify the top-level translation unit parsing gunk
Swift SVN r1086
2012-01-19 00:39:33 +00:00
Chris Lattner
1c7d9f79ba simplify value-specifier code to eliminate the 'expr single' previous special case.
Since we reworked how expression binding works, this complexity isn't needed anymore.


Swift SVN r1083
2012-01-18 23:56:19 +00:00
John McCall
ea5e37e276 Getterize uses of TupleTypeElt. I'm trying to figure out how
parameter attributes should work here.



Swift SVN r1066
2012-01-18 04:05:25 +00:00
Chris Lattner
1c42e8f6a6 rename DottedNameType to IdentifierType. It captures loc information for random uses of type names, among other things.
Swift SVN r1064
2012-01-18 01:52:28 +00:00
Chris Lattner
ac190abfef completely eliminate the type symbol table. "boom".
Swift SVN r1058
2012-01-17 07:43:32 +00:00
Chris Lattner
2f7cd03c6b switch type lookup to use value lookup for everything. Dead code ahoy.
Swift SVN r1057
2012-01-17 07:36:16 +00:00
Chris Lattner
9a3d4dbdd6 inject explicit type aliases into the value symbol table.
Swift SVN r1056
2012-01-17 07:20:02 +00:00
Chris Lattner
c8ca11a199 Drop in the new DottedNameType and wire it up in name binding.
This is horribly hack and slash (but enough to pass all tests) for a few reasons:
- I've #if 0'd out the tendrils of the old code 
- This handles *just* what was handled before instead of being more general
- We don't have an llvm::MutableArrayRef type, so there is some really gross
  const_cast'ing and other struggles to deal with its absence.



Swift SVN r1050
2012-01-17 06:32:00 +00:00
Chris Lattner
f5799a5b0b don't inject the struct constructor into the containing translation unit, because this will affect name lookup done by the name binder, causing an ambiguity error.
Swift SVN r1027
2012-01-12 21:51:51 +00:00
Chris Lattner
eb165f03ab ok, take a big jump and inject the metatype for a oneof into its
scope... instead of injecting the constructor function for a struct.  Everything 
still seems to work!

This will allow us to greatly simplify name lookup, etc but this isn't done yet.


Swift SVN r1018
2012-01-12 08:03:40 +00:00
Chris Lattner
89587ef545 add a comment.
Swift SVN r998
2012-01-06 22:21:18 +00:00
Chris Lattner
b737b112e7 modernize ProtocolType a bit to follow the form of OneOfType
Swift SVN r991
2012-01-05 21:51:48 +00:00
Chris Lattner
17b11e9bbd implement parsing, AST, and LangRef support for 'plus' methods. Dot syntax will need some work though to actually use them.
Swift SVN r949
2011-12-21 23:21:58 +00:00
Chris Lattner
cc0529ba34 remove support for "func foo::bar() {}". "Just use extensions".
Swift SVN r947
2011-12-21 22:45:37 +00:00
Chris Lattner
5f1f4d8ce9 simplify code in Parser::actOnOneOfType now that oneof's always have names.
Give OneOfType an ivar for its TypeAlias.  It already knew its DeclContext.



Swift SVN r923
2011-12-13 01:41:19 +00:00
John McCall
4167366d02 Parse resilience attributes.
Swift SVN r921
2011-12-10 02:43:40 +00:00
John McCall
a1f7eefba3 Extract out decl attributes into a separately-allocated structure.
Swift SVN r920
2011-12-10 00:39:10 +00:00
John McCall
6b935588e5 On second thought, components need to be known in the AST.
Swift SVN r918
2011-12-07 03:57:41 +00:00
Chris Lattner
0b72409c9c ensure that extension members get the proper function type, and a 'this' argument.
Swift SVN r908
2011-12-06 20:23:53 +00:00
Chris Lattner
32b248b7e3 [gs]etterize various members of Module, and make them check the invariants they depend on.
Swift SVN r903
2011-12-06 01:02:09 +00:00
Chris Lattner
212b56afec actually, the ASTStage should be on Translation unit. There can be multiple modules in a context and they can all be in different phases of translation.
Swift SVN r902
2011-12-06 00:51:56 +00:00
Chris Lattner
8d53c9f3b9 restrict 'extension' to only exist at file scope.
Swift SVN r899
2011-12-06 00:11:13 +00:00
Chris Lattner
603e22a97b diagnose operators in extensions, just an oversight.
Swift SVN r898
2011-12-05 23:37:57 +00:00
Chris Lattner
2e0df0bbfc make oneof and struct decls generate their implicit 'extension' decl for their members.
Swift SVN r897
2011-12-05 23:32:12 +00:00
Chris Lattner
d9c15ebb9a make ExtensionDecl be a DeclContext, install members into it properly.
Swift SVN r896
2011-12-05 23:22:04 +00:00
Chris Lattner
ef5fc52220 add basic type checking.
Swift SVN r893
2011-11-29 22:45:38 +00:00
John McCall
32736ea2ab Rename hasSingleElement to isTransparentType to better
capture what's being tested.  This also makes IR gen
correctly avoid a discriminator for a non-transparent
single-element oneof.



Swift SVN r887
2011-11-18 01:17:53 +00:00
John McCall
b700f171a2 More getters.
Swift SVN r886
2011-11-18 01:10:03 +00:00
John McCall
d716f82984 Getterize ValueDecl.
Swift SVN r885
2011-11-18 01:04:12 +00:00
John McCall
9079154ded Getterize TypeAliasDecl.
Swift SVN r884
2011-11-18 00:48:14 +00:00
John McCall
50fb0d63f6 More incremental getterization.
.w



Swift SVN r883
2011-11-18 00:29:15 +00:00
John McCall
d74f17259c Incremental getterization of Decl.h.
Swift SVN r882
2011-11-18 00:17:20 +00:00
Chris Lattner
bd663190d9 parse (and still discard) the body of an extension.
Swift SVN r866
2011-11-10 21:52:42 +00:00
Doug Gregor
fc183b9cc3 Decouple the lexer from the ASTContext and specific BufferID. They
aren't needed for the lexer proper (which just needs a buffer to dig
through). Also, make it possible to suppress lexer diagnostics merely
by not giving it a diagnostic engine to work with.


Swift SVN r852
2011-11-09 21:49:40 +00:00