Commit Graph

22435 Commits

Author SHA1 Message Date
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
John McCall
de3c3ff04d Build an implicit expression to record the conversion
of a oneof to its underlying type.  Much better.



Swift SVN r881
2011-11-17 11:38:05 +00:00
Chris Lattner
4f7c4c535e random tidying
Swift SVN r868
2011-11-10 22:12:09 +00:00
Chris Lattner
7e96d0d53e embrace macro metaprogramming for decls.
Swift SVN r867
2011-11-10 22:08:46 +00:00
Doug Gregor
1ed6cdbb09 Fix broken source-range information for expressions of the form "x.y".
Swift SVN r861
2011-11-10 17:25:08 +00:00
Doug Gregor
55f635a0c0 Introduce an additional "context" parameter to the expression and
statement walk callback functions, where we can stash additional
information without breaking all of the callers. 

At present, the only information in the context is the parent
statement or expression.


Swift SVN r860
2011-11-10 17:02:43 +00:00
Doug Gregor
2e49b79617 Rename WalkOrder.h to Walk.h, and introduce typedefs for the function
types of the expression and statement walker into it, so we don't end
up typing the same darned things over and over again.


Swift SVN r859
2011-11-10 16:36:56 +00:00
Doug Gregor
a8de31b0e0 Implement Stmt::getSourceRange() along with proper implementations for
each of the subclasses.


Swift SVN r857
2011-11-10 00:46:07 +00:00
Doug Gregor
9995a39aae Switch Expr::getLoc() over to an implementation that defaults to the
starting location of the expression, but can be overridden by
subclasses.


Swift SVN r856
2011-11-10 00:34:40 +00:00
Doug Gregor
0223f3edf1 Implement Expr::getSourceRange() and introduce proper support for this
function into all of the expression nodes. Re-implement
Expr::getStartLoc() in terms of this function, and add it's brother
Expr::getEndLoc(), removing the specialized implementations.

Clean up the source ranges of implicitly-created tuple expressions in
the process.


Swift SVN r855
2011-11-10 00:25:48 +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
Doug Gregor
725298a2da Introduce a DiagnosticConsumer abstract interface that is used to
actually render emitted diagnostics. This is both a useful
generalization (we expect to have a number of other
DiagnosticConsumers down the road, as Clang does) and is also
important now to avoid a layering violation when adjusting the source
location at the end of a SourceRange to the end of the token.

 


Swift SVN r850
2011-11-09 18:59:39 +00:00
Doug Gregor
cd7a21de83 Introduce support for adding source ranges to diagnostics.
We don't yet properly perform the SourceRange -> llvm::SMRange mapping. 

Swift SVN r847
2011-11-09 17:53:30 +00:00
Doug Gregor
e12215b1be Introduce InFlightDiagnostic, a move-only class that will be used to emit "extra" information (ranges, Fix-Its, etc.) for a diagnostic. It's quite similar in design to Clang's DiagnosticBuilder, but slightly cleaner/more restrictive.
Note that I had to re-implement llvm::Optional, since it lamely requires a default constructor. At some point, I'll push a proper implementation back to LLVM.

Swift SVN r845
2011-11-09 17:19:30 +00:00
Doug Gregor
7106232181 Generalize the Diag<...> specializations within Diagnostic and
DiagnosticEngine so that they work properly (without extensions) for
zero arguments. Then, eliminate the zero-argument specializations.


Swift SVN r844
2011-11-09 16:00:36 +00:00
Chris Lattner
ffa9a55002 implement skeleton of extension body parsing.
Swift SVN r839
2011-11-09 00:49:54 +00:00
Chris Lattner
0b9b982758 rework parseDecl to do validation itself, allow decls in oneof's
Swift SVN r837
2011-11-08 22:41:27 +00:00
Chris Lattner
d95aadc8bf structs can now contain any 'decl'
Swift SVN r831
2011-11-08 19:45:24 +00:00
Chris Lattner
eac219bee8 Rework the decl grammar a bit: now "decl" doesn't include import
declarations, but they are explicitly allowed at translation unit scope.
This also introduces a parseDecl method which does the obvious thing.



Swift SVN r830
2011-11-08 19:30:00 +00:00
Chris Lattner
b61fe6db10 reject unnamed members in structs.
Swift SVN r829
2011-11-08 00:08:05 +00:00
Chris Lattner
ff63661812 disallow operators in structs.
Swift SVN r827
2011-11-07 23:39:15 +00:00
Chris Lattner
32af5d5038 add a test for .area on rects.
Swift SVN r825
2011-11-03 22:37:24 +00:00
Chris Lattner
b559c3f648 allow var's and funcs within structs, part of rdar://10157702
Swift SVN r824
2011-11-03 22:19:48 +00:00
Chris Lattner
dce8416508 allow dyn_cast'ing from declcontext to OneOfType.
Swift SVN r820
2011-11-02 00:33:06 +00:00
Chris Lattner
9e9f421f1a getAliasType() doesn't need an ASTContext argument anymore.
Swift SVN r816
2011-11-01 18:37:05 +00:00
Chris Lattner
da564d50d3 A long journey later, implement support for type inference of integer literals instead of
forcing them to int64 all the time.  Now the integer_literal_type in the standard library
is only used to resolve ambiguity in expressions.  Among other amazing things, we now
correctly accept:

  var x8 : int8 = 4

without a cast.

This still isn't doing any bounds checking and isn't checking the inferred type to tell if
it is compatible with integer literals (i.e. has a primitive conversion function from the
LLVM IR type).  Enough for now though.

This is progress towards rdar://10357238.



Swift SVN r814
2011-11-01 06:51:50 +00:00
Chris Lattner
164ab0ffee move lookupTypeName out to Module::lookupGlobalType and have it look in the current
module as well for consistency.


Swift SVN r811
2011-11-01 06:27:24 +00:00
Chris Lattner
e0a18996cd move lookupGlobalValue into Module, making it accessable to all of sema.
Swift SVN r810
2011-11-01 06:22:44 +00:00
Chris Lattner
5d8d0fd2f6 Have the name binder publish the list of imported modules into the TranslationUnit,
making it a real part of the AST.  Also, rework TUModuleCache to do its computation
when it is constructed, instead of trying in each query.


Swift SVN r809
2011-11-01 06:19:36 +00:00
Chris Lattner
e3b53c3b15 move the module-level name lookup stuff out of NameBinding.cpp into the
Module class.  Add a new Module.cpp file to implement this (along with
the existing caching strategy, if you're curious).  This eliminates the
parallel 'ModuleProvider' heirarchy.


Swift SVN r802
2011-11-01 05:19:35 +00:00
Chris Lattner
4933a27098 clean up lookupType/lookupValue to only take an AccessPath instead of an import decl.
Strip of the module name implicit in the access path.


Swift SVN r801
2011-11-01 04:43:51 +00:00
Chris Lattner
2ea1e72890 merge two copies of the same predicate into a helper method.
Swift SVN r800
2011-11-01 04:30:25 +00:00
Chris Lattner
0ca79b1075 rename ASTContext::BuiltinModule -> TheBuiltinModule for consistency with
the other ASTContext members.


Swift SVN r799
2011-11-01 04:18:23 +00:00
Chris Lattner
8e1c6c8ac6 flatten ModuleKind discriminator into DeclContext's one. Now Module is an
abstract class and we have an actual AST-level concept of the builtin module.


Swift SVN r798
2011-11-01 04:07:57 +00:00
Chris Lattner
fed35466d4 increase the # bits for DeclContextKind's to 3 bits.
Swift SVN r797
2011-11-01 03:58:21 +00:00
Chris Lattner
22808d5970 introduce a new Diagnostic class to represent a diagID + arguments.
Swift SVN r784
2011-10-22 06:03:30 +00:00
Chris Lattner
2cee9d300b simplify code a bit, I hear that classes with ctors can be in unions these days.
Swift SVN r783
2011-10-22 05:47:46 +00:00
Chris Lattner
9298082ebb move Diagnostics header to include/swift/AST to match .cpp files.
Swift SVN r782
2011-10-22 00:47:35 +00:00
Chris Lattner
f92f616aaf remove hte ASTContext::hadError bool.
Swift SVN r778
2011-10-22 00:32:39 +00:00
Chris Lattner
51680e3fdc remove the deprecated error/warning/note methods, finally.
Swift SVN r776
2011-10-22 00:26:34 +00:00
Chris Lattner
60afdf4842 switch irgen to new diags
Swift SVN r769
2011-10-20 21:29:50 +00:00
Chris Lattner
9f906da738 sink (a copy of) HadError into DiagnosticEngine, so that errors produced by it trigger error returns from main().
Swift SVN r768
2011-10-20 20:55:22 +00:00
Chris Lattner
3c43cae8b4 now that types can get their astcontext, remove some pointless argument passing.
Swift SVN r757
2011-10-18 23:25:42 +00:00
Chris Lattner
7aaf0c5e0c rework the canonical type system a bit to make it so that all Types can access
their ASTContext without bloating everything.  Basically, now instead of having
a canonical type point to itself when canonical, it points to the ASTContext 
when canonical.  This means that Canonical types always have direct access to
their context and non-canonical ones just indirect through the canonical type
pointer to get to it (so it's two jumps away) by using a PointerUnion.

This should make type manipulation more straight-forward.

While we're at it, we actually memoize type canonicalization.  Before we 
forgot to remember the result in the canonical type pointer in Type.


Swift SVN r755
2011-10-18 22:32:56 +00:00
Chris Lattner
d69b3cec39 add a helper method, not particularly useful yet because not all decls have a DeclContext.
Swift SVN r753
2011-10-18 21:52:46 +00:00
Chris Lattner
55651745b5 remove helper method, it is the same as T->isEqual(S, Ctx)
Swift SVN r752
2011-10-18 21:47:08 +00:00
Chris Lattner
33b3a22999 fix a fixme around a dead method.
Swift SVN r751
2011-10-18 01:27:13 +00:00